优化:完善分类规则与Excel配置维护并加速查询翻页

This commit is contained in:
2026-10-31 17:50:14 +08:00
parent 9dbe85c65c
commit aa7c320dc6
56 changed files with 1709 additions and 440 deletions
+15 -1
View File
@@ -1,5 +1,19 @@
import { createContext, useContext } from 'react';
import { createContext, useContext, useEffect, useRef } from 'react';
export const WORKSPACE_INVALIDATED = 'quality-workspace-invalidated';
export const PageCacheContext = createContext({ active: true, initialSearch: undefined as string | undefined, refreshKey: 0, onLocationChange: (_search: string) => {} });
export const usePageCache = () => useContext(PageCacheContext);
/** Revalidate retained maintenance data on a real revision change, not on every visit. */
export function useMaintenanceRefresh(reload: () => void) {
const { active, refreshKey } = usePageCache();
const seen = useRef(refreshKey);
const latest = useRef(reload);
latest.current = reload;
useEffect(() => {
if (active && seen.current !== refreshKey) {
seen.current = refreshKey;
latest.current();
}
}, [active, refreshKey]);
}