import { Suspense, lazy } from "react"; // ⭐⭐ WAVE 37 · T48 — LAZY, AND IT IS THE LAST OF THE THREE EAGER IMPORTS. `CustomerGrid` (7,715 // lines) plus glide-data-grid sat in the ENTRY chunk because these three files imported it at the // top level, while twelve other surfaces were already `lazy()`. Measured on the deployed build // (`proto/P4-first-load.md` §A.2): the entry chunk was 580,102 B on the wire and took 5.6-5.8 s, // during which `#root` was EMPTY and the screen was white — 6.0-8.0 s of the 11.6-16.0 s first open. // ⚠ THE EMBED PAYS THIS TOO, and it is the one path where the grid IS the page, so its fallback is // deliberately the same skeleton shape the shell uses rather than `null`: a blank iframe is // indistinguishable from a broken one. const CustomerGrid = lazy(() => import("./customer-grid/CustomerGrid")); import { OverlayProvider } from "./customer-grid/OverlaySurface"; import { isStreamlitComponent } from "./customer-grid/hostBridge"; import Shell from "./shell/Shell"; import { installViewAs } from "./settings/viewAs"; // HOSTED = either Streamlit path (the component iframe, or the legacy injected // payload). There the surrounding app owns all chrome and this tree renders the // BARE grid, byte-for-byte the behavior the embed always had. Only the // standalone build gets the shell (wave 4, the strangler frame). Computed once // at module level, like useCustomerData's own mode constants — the host mode // cannot change within a page lifetime. // EXPORTED (EXIT wave 1): main.tsx needs the same answer to decide whether to // install the standalone event sink, and two copies of a mode predicate is how // the two halves of "standalone-only" end up disagreeing. export const HOSTED = isStreamlitComponent() || typeof (window as unknown as { __AIOS_GRID__?: unknown }).__AIOS_GRID__ !== "undefined"; // S85-T157: the member view transport. Module scope runs before `main.tsx` installs edge retry // and the activity log, so both wrap it, and before Shell's first `me()`. Entering or leaving the // view reloads the whole frame: no cache, route or request outlives the identity that made it. if (!HOSTED) installViewAs(() => window.location.reload()); export default function App() { if (HOSTED) { return (
); } return ; }