mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-08-21 16:34:21 +08:00
⚡️ perf(native-window): 稳定结果同步回调避免全量序列化
This commit is contained in:
@@ -335,6 +335,16 @@ const NativeDetachedWindowApp: React.FC<NativeDetachedWindowAppProps> = ({
|
||||
const hostEventSequenceRef = useRef(0);
|
||||
const workbenchStateSourceRef = useRef<NativeDetachedStoreSnapshot>({});
|
||||
const syncedWorkbenchTabIdsRef = useRef<Set<string>>(new Set());
|
||||
const handleQueryResultDataChange = useCallback((rows: Array<Record<string, unknown>>) => {
|
||||
const resultWindow = queryResultWindowRef.current;
|
||||
if (!resultWindow) return;
|
||||
queryResultWindowRef.current = {
|
||||
...resultWindow,
|
||||
result: { ...resultWindow.result, rows },
|
||||
};
|
||||
queryResultDirtyGenerationRef.current += 1;
|
||||
scheduleSyncRef.current(false);
|
||||
}, []);
|
||||
|
||||
const themeMode = useStore((state) => state.theme);
|
||||
const uiVersion = useStore((state) => state.appearance.uiVersion);
|
||||
@@ -1179,16 +1189,7 @@ const NativeDetachedWindowApp: React.FC<NativeDetachedWindowAppProps> = ({
|
||||
aiTerminalGuardRef.current = guard;
|
||||
}}
|
||||
interactionDisabled={Boolean(terminalAction)}
|
||||
onQueryResultDataChange={(rows) => {
|
||||
const resultWindow = queryResultWindowRef.current;
|
||||
if (!resultWindow) return;
|
||||
queryResultWindowRef.current = {
|
||||
...resultWindow,
|
||||
result: { ...resultWindow.result, rows },
|
||||
};
|
||||
queryResultDirtyGenerationRef.current += 1;
|
||||
scheduleSyncRef.current(false);
|
||||
}}
|
||||
onQueryResultDataChange={handleQueryResultDataChange}
|
||||
/>
|
||||
</React.Suspense>
|
||||
) : null}
|
||||
|
||||
Reference in New Issue
Block a user