fix: clear models expand keys

This commit is contained in:
jialin
2025-01-17 14:35:36 +08:00
parent 0690612477
commit 58fcc90417
6 changed files with 81 additions and 24 deletions
@@ -183,6 +183,20 @@ const TableRow: React.FC<
}
}, [expanded]);
useEffect(() => {
const handleVisibilityChange = async () => {
if (document.visibilityState === 'hidden') {
cacheDataListRef.current = [];
}
};
document.addEventListener('visibilitychange', handleVisibilityChange);
return () => {
document.removeEventListener('visibilitychange', handleVisibilityChange);
};
}, []);
useEffect(() => {
if (!firstLoad && expanded) {
cacheDataListRef.current = childrenData;