perf(web): add dashboard hydration observability
This commit is contained in:
parent
b6de67f081
commit
328f6e00bf
5 changed files with 339 additions and 22 deletions
|
|
@ -10,6 +10,7 @@ import type { DashboardRuntimeState } from "$lib/server/dashboard";
|
|||
import {
|
||||
attachDashboardRefreshLifecycle,
|
||||
collectVisibleDashboardModelIds,
|
||||
createDashboardPerformanceMarks,
|
||||
createDashboardRefreshDelay,
|
||||
createDashboardTileSnapshotStore,
|
||||
createDashboardTileBackoff,
|
||||
|
|
@ -174,6 +175,7 @@ export default function App() {
|
|||
let lastRefreshIntervalMs = dashboardFallbackRefreshIntervalMs;
|
||||
let hydrationRun = 0;
|
||||
const requestAborter = createDashboardRequestAborter();
|
||||
const performanceMarks = createDashboardPerformanceMarks();
|
||||
const refreshDelay = createDashboardRefreshDelay();
|
||||
const tileBackoff = createDashboardTileBackoff();
|
||||
const tileSnapshotStore = createDashboardTileSnapshotStore(
|
||||
|
|
@ -222,6 +224,7 @@ export default function App() {
|
|||
|
||||
if (cancelled || shellSignal.aborted || refreshPaused()) return;
|
||||
refreshDelay.recordSuccess();
|
||||
performanceMarks.markShellLoad();
|
||||
const restored = restoreDashboardTileSnapshots(
|
||||
nextDashboard,
|
||||
nextDashboard.state === "ready"
|
||||
|
|
@ -319,6 +322,8 @@ export default function App() {
|
|||
}
|
||||
},
|
||||
items: tiles,
|
||||
onAllItemsSettled: () => performanceMarks.markAllTilesSettled(),
|
||||
onVisibleItemsSettled: () => performanceMarks.markVisibleTilesReady(),
|
||||
signal,
|
||||
waitForIdle: () =>
|
||||
waitForDashboardHydrationIdle({
|
||||
|
|
@ -367,6 +372,7 @@ export default function App() {
|
|||
...snapshotContext,
|
||||
response: readyTileResponse,
|
||||
});
|
||||
performanceMarks.markFirstTileReady();
|
||||
return "ready";
|
||||
} catch (error) {
|
||||
if (!isAbortError(error) && !cancelled) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue