The pages carry the CMS markers (data block, list regions, JSON-LD price, inline price); PackagesProvider reads the host's data block after hydration and asks the API only when there is none; the site address comes from the block. A stand-in for the host (config/hostInjector.ts, --cms-data in the preview server) and browser tests check the behaviour with different data. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
26 lines
905 B
TypeScript
26 lines
905 B
TypeScript
import { StrictMode, startTransition } from 'react';
|
|
import { hydrateRoot } from 'react-dom/client';
|
|
import { StartClient } from '@tanstack/react-start/client';
|
|
import { readCmsData } from './lib/cmsData';
|
|
import { startSentry } from './monitoring/sentry';
|
|
import { setSiteUrl } from './seo';
|
|
|
|
// Foutmeldingen naar Sentry, alleen op test en productie (M1). Dit bestand
|
|
// draait alleen in de browser, dus niet tijdens het prerenderen, en loopt voor
|
|
// op het hydrateren zodat ook vroege fouten gemeld worden.
|
|
startSentry();
|
|
|
|
// The CMS host writes the address of the site it serves into the data block;
|
|
// the script files cannot carry it. Without a block the built-in one stays.
|
|
const page = readCmsData(document);
|
|
if (page?.siteUrl) setSiteUrl(page.siteUrl);
|
|
|
|
startTransition(() => {
|
|
hydrateRoot(
|
|
document,
|
|
<StrictMode>
|
|
<StartClient />
|
|
</StrictMode>,
|
|
);
|
|
});
|