| 1 | import { StrictMode, startTransition } from "react"; |
| 2 | import { hydrateRoot } from "react-dom/client"; |
| 3 | import { HydratedRouter } from "react-router/dom"; |
| 4 | |
| 5 | // Product analytics, started before the app (lib/analytics.client.ts). |
| 6 | import "./lib/analytics.client"; |
| 7 | import { installResilientFetch } from "./lib/resilient-fetch"; |
| 8 | |
| 9 | // The router's reads outlast a moment offline (lib/resilient-fetch.ts). |
| 10 | installResilientFetch(import.meta.env.G1T_BUILD_ID); |
| 11 | |
| 12 | startTransition(() => { |
| 13 | hydrateRoot( |
| 14 | document, |
| 15 | <StrictMode> |
| 16 | <HydratedRouter /> |
| 17 | </StrictMode>, |
| 18 | { |
| 19 | // React recovers from a page the server rendered differently by |
| 20 | // rendering it again here; say where, so it can be fixed. |
| 21 | onRecoverableError(error, info) { |
| 22 | console.error("g1t: recovered from", error, info.componentStack); |
| 23 | }, |
| 24 | }, |
| 25 | ); |
| 26 | }); |