refactor(app): centralize perf diagnostics and activity coalescing

This commit is contained in:
Mohamed Boudra
2026-02-22 11:52:08 +07:00
parent d7e2ab4437
commit d6b7c2ed2d
24 changed files with 1119 additions and 81 deletions
@@ -0,0 +1,21 @@
import { createContext } from "react";
import type { PerfDiagnosticsReporter, PerfDiagnosticsSnapshot } from "./types";
const EMPTY_SNAPSHOT: PerfDiagnosticsSnapshot = {
enabled: false,
monitorScope: null,
breadcrumbCount: 0,
breadcrumbs: [],
};
const NOOP_REPORTER: PerfDiagnosticsReporter = {
mark: () => {},
installMonitor: () => () => {},
consumeReports: async () => [],
peekReports: async () => [],
isEnabled: () => false,
getSnapshot: () => EMPTY_SNAPSHOT,
};
export const PerfDiagnosticsContext =
createContext<PerfDiagnosticsReporter>(NOOP_REPORTER);