fix(editor): stop preloading data grid chunk on tab open

This commit is contained in:
Melody Ruch authored and GitHub committed 2026-09-04 16:49:05 +08:00
1 parent af32936297
commit 7f7f011f40
1 file changed
+8 -6
@@ -232,12 +232,14 @@ const { toast } = useToast();
const DEFAULT_QUERY_RESULTS_PANE_SIZE = 68; const DEFAULT_QUERY_RESULTS_PANE_SIZE = 68;
onMounted(() => { onMounted(() => {
const preload = () => preloadDataGridComponent(); // Deliberately not preloading DataGrid here for every tab: evaluating that
if ("requestIdleCallback" in window) { // chunk is expensive (large component graph) and previously ran
window.requestIdleCallback(preload, { timeout: 1500 }); // unconditionally shortly after any tab mounted, including source-only
} else { // tabs (e.g. viewing a large object's DDL) that never need a grid. That
setTimeout(preload, 300); // turned a "warm the cache" optimization into a multi-second main-thread
} // freeze right when the user was trying to read the newly-opened tab (see
// issue #8103). The watcher below still preloads it eagerly for tabs that
// actually need one.
window.addEventListener("dbx-refresh-active-kv-browser", onRefreshActiveKvBrowser); window.addEventListener("dbx-refresh-active-kv-browser", onRefreshActiveKvBrowser);
window.addEventListener("resize", updateStandaloneResultToolbarDimensions); window.addEventListener("resize", updateStandaloneResultToolbarDimensions);
window.visualViewport?.addEventListener("resize", updateStandaloneResultToolbarDimensions); window.visualViewport?.addEventListener("resize", updateStandaloneResultToolbarDimensions);