@decocms/tanstack 8.1.0-next.0 → 8.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +79 -0
- package/dist/draft.d.ts +33 -0
- package/dist/draft.d.ts.map +1 -0
- package/dist/draft.js +41 -0
- package/dist/draft.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/react/DecoDocument.d.ts +61 -0
- package/dist/react/DecoDocument.d.ts.map +1 -0
- package/dist/react/DecoDocument.js +96 -0
- package/dist/react/DecoDocument.js.map +1 -0
- package/dist/react/Image.d.ts +96 -0
- package/dist/react/Image.d.ts.map +1 -0
- package/dist/react/Image.js +79 -0
- package/dist/react/Image.js.map +1 -0
- package/dist/react/index.d.ts +7 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +7 -0
- package/dist/react/index.js.map +1 -0
- package/dist/react/pageValues.d.ts +10 -0
- package/dist/react/pageValues.d.ts.map +1 -0
- package/dist/react/pageValues.js +29 -0
- package/dist/react/pageValues.js.map +1 -0
- package/dist/react/scripts.d.ts +14 -0
- package/dist/react/scripts.d.ts.map +1 -0
- package/dist/react/scripts.js +96 -0
- package/dist/react/scripts.js.map +1 -0
- package/dist/router/index.d.ts +38 -0
- package/dist/router/index.d.ts.map +1 -0
- package/dist/router/index.js +60 -0
- package/dist/router/index.js.map +1 -0
- package/dist/scope/browser.d.ts +11 -0
- package/dist/scope/browser.d.ts.map +1 -0
- package/dist/scope/browser.js +8 -0
- package/dist/scope/browser.js.map +1 -0
- package/dist/scope/server.d.ts +13 -0
- package/dist/scope/server.d.ts.map +1 -0
- package/dist/scope/server.js +26 -0
- package/dist/scope/server.js.map +1 -0
- package/dist/server/index.d.ts +27 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +31 -0
- package/dist/server/index.js.map +1 -0
- package/dist/shared.d.ts +26 -0
- package/dist/shared.d.ts.map +1 -0
- package/dist/shared.js +26 -0
- package/dist/shared.js.map +1 -0
- package/dist/start/index.d.ts +9 -0
- package/dist/start/index.d.ts.map +1 -0
- package/dist/start/index.js +33 -0
- package/dist/start/index.js.map +1 -0
- package/dist/studio.d.ts +28 -0
- package/dist/studio.d.ts.map +1 -0
- package/dist/studio.js +53 -0
- package/dist/studio.js.map +1 -0
- package/dist/vite/index.d.ts +15 -0
- package/dist/vite/index.d.ts.map +1 -0
- package/dist/vite/index.js +95 -0
- package/dist/vite/index.js.map +1 -0
- package/dist/worker/cacheProfiles.d.ts +43 -0
- package/dist/worker/cacheProfiles.d.ts.map +1 -0
- package/dist/worker/cacheProfiles.js +162 -0
- package/dist/worker/cacheProfiles.js.map +1 -0
- package/dist/worker/cookies.d.ts +20 -0
- package/dist/worker/cookies.d.ts.map +1 -0
- package/dist/worker/cookies.js +69 -0
- package/dist/worker/cookies.js.map +1 -0
- package/dist/worker/drafts.d.ts +59 -0
- package/dist/worker/drafts.d.ts.map +1 -0
- package/dist/worker/drafts.js +140 -0
- package/dist/worker/drafts.js.map +1 -0
- package/dist/worker/index.d.ts +107 -0
- package/dist/worker/index.d.ts.map +1 -0
- package/dist/worker/index.js +511 -0
- package/dist/worker/index.js.map +1 -0
- package/dist/worker/security.d.ts +14 -0
- package/dist/worker/security.d.ts.map +1 -0
- package/dist/worker/security.js +48 -0
- package/dist/worker/security.js.map +1 -0
- package/dist/worker/segment.d.ts +21 -0
- package/dist/worker/segment.d.ts.map +1 -0
- package/dist/worker/segment.js +43 -0
- package/dist/worker/segment.js.map +1 -0
- package/package.json +85 -37
- package/src/draft.ts +43 -0
- package/src/index.ts +8 -61
- package/src/react/DecoDocument.tsx +234 -0
- package/src/react/Image.tsx +213 -0
- package/src/react/index.ts +24 -0
- package/src/react/pageValues.ts +35 -0
- package/src/react/scripts.ts +98 -0
- package/src/router/index.ts +80 -0
- package/src/scope/browser.ts +18 -0
- package/src/scope/server.ts +37 -0
- package/src/server/index.ts +43 -0
- package/src/shared.ts +29 -0
- package/src/start/index.ts +31 -0
- package/src/studio.ts +52 -0
- package/src/vite/index.ts +105 -0
- package/src/worker/cacheProfiles.ts +180 -0
- package/src/worker/cookies.ts +65 -0
- package/src/worker/drafts.ts +157 -0
- package/src/worker/index.ts +648 -0
- package/src/worker/security.ts +63 -0
- package/src/worker/segment.ts +49 -0
- package/src/__conformance__/observability.test.ts +0 -221
- package/src/cms/kvBlockSource.test.ts +0 -82
- package/src/cms/kvBlockSource.ts +0 -68
- package/src/daemon/auth.ts +0 -204
- package/src/daemon/fs.ts +0 -238
- package/src/daemon/index.ts +0 -8
- package/src/daemon/middleware.ts +0 -156
- package/src/daemon/tunnel.ts +0 -129
- package/src/daemon/volumes.ts +0 -366
- package/src/daemon/watch.ts +0 -272
- package/src/hooks/CdnSegmentMarker.tsx +0 -38
- package/src/hooks/DecoPageRenderer.tsx +0 -750
- package/src/hooks/DecoRootLayout.tsx +0 -192
- package/src/hooks/DraftPreviewIndicator.test.tsx +0 -60
- package/src/hooks/DraftPreviewIndicator.tsx +0 -64
- package/src/hooks/NavigationProgress.test.tsx +0 -58
- package/src/hooks/NavigationProgress.tsx +0 -63
- package/src/hooks/PreviewProviders.test.tsx +0 -42
- package/src/hooks/PreviewProviders.tsx +0 -45
- package/src/hooks/StableOutlet.tsx +0 -30
- package/src/hooks/deferredObserverTiming.test.tsx +0 -91
- package/src/hooks/index.ts +0 -10
- package/src/routes/adminRoutes.test.ts +0 -99
- package/src/routes/adminRoutes.ts +0 -153
- package/src/routes/cmsRoute.test.ts +0 -267
- package/src/routes/cmsRoute.ts +0 -1053
- package/src/routes/components.tsx +0 -57
- package/src/routes/index.ts +0 -24
- package/src/routes/pageUrl.test.ts +0 -70
- package/src/routes/pageUrl.ts +0 -55
- package/src/routes/withSiteGlobals.test.ts +0 -243
- package/src/routes/withSiteGlobals.ts +0 -243
- package/src/sdk/backgroundTasks.test.ts +0 -68
- package/src/sdk/backgroundTasks.ts +0 -38
- package/src/sdk/cdnSegment.test.ts +0 -67
- package/src/sdk/cdnSegment.ts +0 -71
- package/src/sdk/cookiePassthrough.ts +0 -58
- package/src/sdk/createInvoke.ts +0 -77
- package/src/sdk/deferredSectionLoader.test.ts +0 -94
- package/src/sdk/deferredSectionLoader.ts +0 -46
- package/src/sdk/draft.test.ts +0 -341
- package/src/sdk/draft.ts +0 -277
- package/src/sdk/draftShared.ts +0 -16
- package/src/sdk/kvHydration.test.ts +0 -371
- package/src/sdk/kvHydration.ts +0 -263
- package/src/sdk/kvRedirects.test.ts +0 -132
- package/src/sdk/kvRedirects.ts +0 -125
- package/src/sdk/outboundHeaders.test.ts +0 -113
- package/src/sdk/outboundHeaders.ts +0 -81
- package/src/sdk/router.ts +0 -101
- package/src/sdk/serverFnFetch.ts +0 -59
- package/src/sdk/speculationRules.test.ts +0 -82
- package/src/sdk/speculationRules.ts +0 -136
- package/src/sdk/startEntry.ts +0 -31
- package/src/sdk/useHydrated.ts +0 -19
- package/src/sdk/workerEntry.cacheStorage.test.ts +0 -147
- package/src/sdk/workerEntry.test.ts +0 -1033
- package/src/sdk/workerEntry.trackingCache.test.ts +0 -328
- package/src/sdk/workerEntry.ts +0 -3154
- package/src/setupFastDeploy.ts +0 -13
- package/src/v8/__conformance__/delivery.test.ts +0 -100
- package/src/v8/binding.ts +0 -70
- package/src/v8/kvLoader.bundle.test.ts +0 -42
- package/src/v8/kvLoader.test.ts +0 -74
- package/src/v8/kvLoader.ts +0 -43
- package/src/vite/plugin-scaffold-gen.test.js +0 -106
- package/src/vite/plugin.js +0 -1022
- package/src/vite/plugin.test.js +0 -238
- package/src/vite/plugin.test.ts +0 -176
- package/tsconfig.json +0 -7
|
@@ -1,750 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type ComponentType,
|
|
3
|
-
createElement,
|
|
4
|
-
lazy,
|
|
5
|
-
type ReactNode,
|
|
6
|
-
Suspense,
|
|
7
|
-
useEffect,
|
|
8
|
-
useRef,
|
|
9
|
-
useState,
|
|
10
|
-
} from "react";
|
|
11
|
-
import { Await, ClientOnly } from "@tanstack/react-router";
|
|
12
|
-
import type { SectionOptions } from "@decocms/blocks/cms/client";
|
|
13
|
-
import {
|
|
14
|
-
getDeferredTrigger,
|
|
15
|
-
getResolvedComponent,
|
|
16
|
-
getSectionOptions,
|
|
17
|
-
getSectionRegistry,
|
|
18
|
-
getSyncComponent,
|
|
19
|
-
preloadSectionModule,
|
|
20
|
-
setResolvedComponent,
|
|
21
|
-
} from "@decocms/blocks/cms/client";
|
|
22
|
-
// Type-only: erased at compile time, so importing from the full barrel here
|
|
23
|
-
// doesn't drag resolve.ts's runtime code (and its node:async_hooks chain)
|
|
24
|
-
// into this component's client bundle.
|
|
25
|
-
import type { DeferredSection, ResolvedSection } from "@decocms/blocks/cms";
|
|
26
|
-
import { type Device, DeviceProvider } from "@decocms/blocks/sdk/useDevice";
|
|
27
|
-
|
|
28
|
-
import { SectionErrorBoundary } from "@decocms/blocks/hooks";
|
|
29
|
-
|
|
30
|
-
type LazyComponent = ReturnType<typeof lazy>;
|
|
31
|
-
|
|
32
|
-
const lazyCache = new Map<string, LazyComponent>();
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Create a React.lazy-compatible thenable that is already fulfilled.
|
|
36
|
-
* React internally checks `thenable.status === "fulfilled"` and reads
|
|
37
|
-
* `thenable.value` synchronously — no Suspense activation, no microtask.
|
|
38
|
-
*/
|
|
39
|
-
function syncThenable(mod: {
|
|
40
|
-
default: ComponentType<any>;
|
|
41
|
-
}): Promise<{ default: ComponentType<any> }> {
|
|
42
|
-
const t = Promise.resolve(mod);
|
|
43
|
-
// React uses these internal properties to detect sync-resolved thenables
|
|
44
|
-
(t as any).status = "fulfilled";
|
|
45
|
-
(t as any).value = mod;
|
|
46
|
-
return t;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function getLazyComponent(key: string) {
|
|
50
|
-
if (!lazyCache.has(key)) {
|
|
51
|
-
// If sync-registered, wrap in a pre-fulfilled lazy so React.lazy
|
|
52
|
-
// resolves synchronously — same tree structure as lazy-only path.
|
|
53
|
-
const sync = getSyncComponent(key);
|
|
54
|
-
if (sync) {
|
|
55
|
-
lazyCache.set(key, lazy(() => syncThenable({ default: sync })));
|
|
56
|
-
return lazyCache.get(key)!;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const registry = getSectionRegistry();
|
|
60
|
-
const loader = registry[key];
|
|
61
|
-
if (!loader) return null;
|
|
62
|
-
lazyCache.set(
|
|
63
|
-
key,
|
|
64
|
-
lazy(() => {
|
|
65
|
-
const resolved = getResolvedComponent(key);
|
|
66
|
-
if (resolved) {
|
|
67
|
-
return syncThenable({ default: resolved });
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
return (loader as () => Promise<{ default: ComponentType<any> }>)().then((mod) => {
|
|
71
|
-
if (!mod?.default) {
|
|
72
|
-
console.error(`[DecoSection] "${key}" has no default export`, Object.keys(mod ?? {}));
|
|
73
|
-
return { default: () => null } as { default: ComponentType<any> };
|
|
74
|
-
}
|
|
75
|
-
setResolvedComponent(key, mod.default);
|
|
76
|
-
return mod as { default: ComponentType<any> };
|
|
77
|
-
});
|
|
78
|
-
}),
|
|
79
|
-
);
|
|
80
|
-
}
|
|
81
|
-
return lazyCache.get(key)!;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
function DefaultSectionFallback() {
|
|
85
|
-
return <div className="w-full h-48 bg-base-200 animate-pulse rounded" />;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
function NestedSectionFallback() {
|
|
89
|
-
return <div className="w-full h-24 bg-base-200 animate-pulse rounded" />;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
import { isDevMode } from "@decocms/blocks/sdk/env";
|
|
93
|
-
|
|
94
|
-
const isDev = isDevMode();
|
|
95
|
-
|
|
96
|
-
// ---------------------------------------------------------------------------
|
|
97
|
-
// Deferred section data cache — persists resolved section props across SPA
|
|
98
|
-
// navigations so navigating back to a page doesn't re-fetch already-loaded
|
|
99
|
-
// sections. TTL is aligned with cmsRouteConfig staleTime (5 min prod / 5s dev).
|
|
100
|
-
// ---------------------------------------------------------------------------
|
|
101
|
-
|
|
102
|
-
const DEFERRED_CACHE_TTL = isDev ? 5_000 : 5 * 60 * 1000;
|
|
103
|
-
|
|
104
|
-
interface DeferredCacheEntry {
|
|
105
|
-
section: ResolvedSection;
|
|
106
|
-
ts: number;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
const deferredSectionCache = new Map<string, DeferredCacheEntry>();
|
|
110
|
-
|
|
111
|
-
function getCachedDeferredSection(stableKey: string): ResolvedSection | null {
|
|
112
|
-
const entry = deferredSectionCache.get(stableKey);
|
|
113
|
-
if (!entry) return null;
|
|
114
|
-
if (Date.now() - entry.ts > DEFERRED_CACHE_TTL) {
|
|
115
|
-
deferredSectionCache.delete(stableKey);
|
|
116
|
-
return null;
|
|
117
|
-
}
|
|
118
|
-
return entry.section;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
const DEFERRED_FADE_CSS = `@keyframes decoFadeIn{from{opacity:0}to{opacity:1}}`;
|
|
123
|
-
|
|
124
|
-
function FadeInStyle() {
|
|
125
|
-
return <style dangerouslySetInnerHTML={{ __html: DEFERRED_FADE_CSS }} />;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
function DevMissingFallbackWarning({ component }: { component: string }) {
|
|
129
|
-
if (!isDev) return null;
|
|
130
|
-
return (
|
|
131
|
-
<div
|
|
132
|
-
style={{
|
|
133
|
-
position: "relative",
|
|
134
|
-
border: "2px dashed #e53e3e",
|
|
135
|
-
borderRadius: 8,
|
|
136
|
-
padding: 8,
|
|
137
|
-
margin: "4px 0",
|
|
138
|
-
}}
|
|
139
|
-
>
|
|
140
|
-
<div
|
|
141
|
-
style={{
|
|
142
|
-
fontSize: 11,
|
|
143
|
-
color: "#e53e3e",
|
|
144
|
-
fontFamily: "monospace",
|
|
145
|
-
marginBottom: 4,
|
|
146
|
-
}}
|
|
147
|
-
>
|
|
148
|
-
[AsyncRender] Missing LoadingFallback for "{component}".
|
|
149
|
-
<br />
|
|
150
|
-
Export a LoadingFallback from your section for better UX.
|
|
151
|
-
<br />
|
|
152
|
-
See: https://deco.cx/docs/async-rendering
|
|
153
|
-
</div>
|
|
154
|
-
<DefaultSectionFallback />
|
|
155
|
-
</div>
|
|
156
|
-
);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
// ---------------------------------------------------------------------------
|
|
160
|
-
// Section type — same shape as deco-cx/deco (Fresh): { Component, props }
|
|
161
|
-
// ---------------------------------------------------------------------------
|
|
162
|
-
|
|
163
|
-
interface Section {
|
|
164
|
-
Component: string | ComponentType<any>;
|
|
165
|
-
props: Record<string, unknown>;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
// ---------------------------------------------------------------------------
|
|
169
|
-
// SectionRenderer — renders a single nested section
|
|
170
|
-
// ---------------------------------------------------------------------------
|
|
171
|
-
|
|
172
|
-
export function SectionRenderer({ section }: { section: Section | null | undefined }) {
|
|
173
|
-
if (!section?.Component) return null;
|
|
174
|
-
|
|
175
|
-
if (typeof section.Component === "function") {
|
|
176
|
-
const Comp = section.Component;
|
|
177
|
-
return <Comp {...(section.props ?? {})} />;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
// Sync path: render directly if available — avoids React.lazy SSR streaming issue
|
|
181
|
-
const options = getSectionOptions(section.Component);
|
|
182
|
-
const isClientOnly = options?.clientOnly === true;
|
|
183
|
-
const SyncComp = getSyncComponent(section.Component);
|
|
184
|
-
if (SyncComp && !isClientOnly) {
|
|
185
|
-
return createElement(SyncComp, section.props ?? {});
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
const Lazy = getLazyComponent(section.Component);
|
|
189
|
-
if (!Lazy) {
|
|
190
|
-
console.warn(`[SectionRenderer] No component registered for: ${section.Component}`);
|
|
191
|
-
return null;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
const fallback = options?.loadingFallback
|
|
195
|
-
? createElement(options.loadingFallback, section.props ?? {})
|
|
196
|
-
: <NestedSectionFallback />;
|
|
197
|
-
|
|
198
|
-
if (isClientOnly) {
|
|
199
|
-
return (
|
|
200
|
-
<ClientOnly fallback={fallback}>
|
|
201
|
-
<Suspense fallback={null}>
|
|
202
|
-
<Lazy {...(section.props ?? {})} />
|
|
203
|
-
</Suspense>
|
|
204
|
-
</ClientOnly>
|
|
205
|
-
);
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
return (
|
|
209
|
-
<Suspense fallback={fallback}>
|
|
210
|
-
<Lazy {...(section.props ?? {})} />
|
|
211
|
-
</Suspense>
|
|
212
|
-
);
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
// ---------------------------------------------------------------------------
|
|
216
|
-
// SectionList — renders an array of nested sections
|
|
217
|
-
// ---------------------------------------------------------------------------
|
|
218
|
-
|
|
219
|
-
export function SectionList({ sections }: { sections: Section[] | null | undefined }) {
|
|
220
|
-
if (!sections?.length) return null;
|
|
221
|
-
return (
|
|
222
|
-
<>
|
|
223
|
-
{sections.map((section, i) => {
|
|
224
|
-
const key = typeof section.Component === "string" ? section.Component : `nested-${i}`;
|
|
225
|
-
return <SectionRenderer key={key} section={section} />;
|
|
226
|
-
})}
|
|
227
|
-
</>
|
|
228
|
-
);
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
// ---------------------------------------------------------------------------
|
|
232
|
-
// DeferredSectionWrapper — loads a section when it scrolls into view
|
|
233
|
-
// ---------------------------------------------------------------------------
|
|
234
|
-
|
|
235
|
-
interface DeferredSectionWrapperProps {
|
|
236
|
-
deferred: DeferredSection;
|
|
237
|
-
pagePath: string;
|
|
238
|
-
pageUrl?: string;
|
|
239
|
-
loadingFallback?: ReactNode;
|
|
240
|
-
errorFallback?: ReactNode;
|
|
241
|
-
loadFn: (data: {
|
|
242
|
-
component: string;
|
|
243
|
-
rawProps?: Record<string, unknown>;
|
|
244
|
-
pagePath: string;
|
|
245
|
-
pageUrl?: string;
|
|
246
|
-
index?: number;
|
|
247
|
-
}) => Promise<ResolvedSection | null>;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
function DeferredSectionWrapper({
|
|
251
|
-
deferred,
|
|
252
|
-
pagePath,
|
|
253
|
-
pageUrl,
|
|
254
|
-
loadingFallback,
|
|
255
|
-
errorFallback,
|
|
256
|
-
loadFn,
|
|
257
|
-
}: DeferredSectionWrapperProps) {
|
|
258
|
-
const stableKey = `${pagePath}::${deferred.component}::${deferred.index}::${deferred.propsHash ?? ""}`;
|
|
259
|
-
const [section, setSection] = useState<ResolvedSection | null>(() =>
|
|
260
|
-
typeof document === "undefined" ? null : getCachedDeferredSection(stableKey),
|
|
261
|
-
);
|
|
262
|
-
const [error, setError] = useState<Error | null>(null);
|
|
263
|
-
const [loadedOptions, setLoadedOptions] = useState<SectionOptions | undefined>(() =>
|
|
264
|
-
getSectionOptions(deferred.component),
|
|
265
|
-
);
|
|
266
|
-
const isSSR = typeof document === "undefined";
|
|
267
|
-
// Allow SSR to render the loadingFallback when registered sync via
|
|
268
|
-
// registerSection(). Previous `isSSR ? false` always returned null,
|
|
269
|
-
// hiding the skeleton from the HTML stream.
|
|
270
|
-
const [optionsReady, setOptionsReady] = useState(() =>
|
|
271
|
-
!!getSectionOptions(deferred.component),
|
|
272
|
-
);
|
|
273
|
-
const ref = useRef<HTMLDivElement>(null);
|
|
274
|
-
const triggered = useRef(false);
|
|
275
|
-
const prevKeyRef = useRef(stableKey);
|
|
276
|
-
|
|
277
|
-
if (prevKeyRef.current !== stableKey) {
|
|
278
|
-
prevKeyRef.current = stableKey;
|
|
279
|
-
triggered.current = false;
|
|
280
|
-
const cached = getCachedDeferredSection(stableKey);
|
|
281
|
-
if (section !== cached) setSection(cached);
|
|
282
|
-
if (error) setError(null);
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
useEffect(() => {
|
|
286
|
-
if (optionsReady) return;
|
|
287
|
-
preloadSectionModule(deferred.component).then((opts) => {
|
|
288
|
-
if (opts) setLoadedOptions(opts);
|
|
289
|
-
setOptionsReady(true);
|
|
290
|
-
});
|
|
291
|
-
}, [deferred.component, optionsReady]);
|
|
292
|
-
|
|
293
|
-
const hasCustomFallback = !!loadedOptions?.loadingFallback;
|
|
294
|
-
const skeleton = !optionsReady
|
|
295
|
-
? null
|
|
296
|
-
: hasCustomFallback
|
|
297
|
-
? createElement(loadedOptions!.loadingFallback!, deferred.rawProps)
|
|
298
|
-
: (loadingFallback ??
|
|
299
|
-
(isDev ? (
|
|
300
|
-
<DevMissingFallbackWarning component={deferred.component} />
|
|
301
|
-
) : (
|
|
302
|
-
<DefaultSectionFallback />
|
|
303
|
-
)));
|
|
304
|
-
|
|
305
|
-
useEffect(() => {
|
|
306
|
-
if (triggered.current || section) return;
|
|
307
|
-
|
|
308
|
-
const el = ref.current;
|
|
309
|
-
if (!el) return;
|
|
310
|
-
|
|
311
|
-
const key = stableKey;
|
|
312
|
-
const load = () => {
|
|
313
|
-
triggered.current = true;
|
|
314
|
-
loadFn({
|
|
315
|
-
component: deferred.component,
|
|
316
|
-
pagePath,
|
|
317
|
-
pageUrl,
|
|
318
|
-
index: deferred.index,
|
|
319
|
-
})
|
|
320
|
-
.then((result) => {
|
|
321
|
-
if (result) deferredSectionCache.set(key, { section: result, ts: Date.now() });
|
|
322
|
-
setSection(result);
|
|
323
|
-
})
|
|
324
|
-
.catch((e) => setError(e));
|
|
325
|
-
};
|
|
326
|
-
|
|
327
|
-
// `"load"` — dispatch on mount, no scroll needed.
|
|
328
|
-
//
|
|
329
|
-
// This is what Deco on Fresh does: `DispatchAsyncRender` with
|
|
330
|
-
// `partialTriggerMode: "load"` clicks the hidden partial trigger as soon as
|
|
331
|
-
// the island hydrates, so a page ships a light skeleton HTML and then fills
|
|
332
|
-
// in every deferred section about half a second later. Sites migrating from
|
|
333
|
-
// Fresh need it for parity — under `"intersection"` alone, everything below
|
|
334
|
-
// the fold does not exist until the user scrolls: the document stays short
|
|
335
|
-
// and below-the-fold analytics impressions never fire.
|
|
336
|
-
//
|
|
337
|
-
// Opt-in per site via `setAsyncRenderingConfig({ deferredTrigger: "load" })`;
|
|
338
|
-
// the default stays `"intersection"`, so a framework bump changes nothing.
|
|
339
|
-
if (getDeferredTrigger() === "load" || typeof IntersectionObserver === "undefined") {
|
|
340
|
-
load();
|
|
341
|
-
return;
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
let observer: IntersectionObserver | undefined;
|
|
345
|
-
const startObserving = () => {
|
|
346
|
-
if (triggered.current) return;
|
|
347
|
-
observer = new IntersectionObserver(
|
|
348
|
-
([entry]) => {
|
|
349
|
-
if (entry?.isIntersecting && !triggered.current) {
|
|
350
|
-
observer?.disconnect();
|
|
351
|
-
load();
|
|
352
|
-
}
|
|
353
|
-
},
|
|
354
|
-
{ rootMargin: "300px" },
|
|
355
|
-
);
|
|
356
|
-
observer.observe(el);
|
|
357
|
-
};
|
|
358
|
-
|
|
359
|
-
// Wait one frame before observing, so the router's scroll reset lands first.
|
|
360
|
-
//
|
|
361
|
-
// On a client (SPA) navigation the scroll position is still wherever the
|
|
362
|
-
// user left the PREVIOUS page when this effect runs. TanStack resets it from
|
|
363
|
-
// the `onRendered` event, which is emitted in a `useLayoutEffect`
|
|
364
|
-
// (react-router's `OnRendered`) that depends on the `resolvedLocation` store
|
|
365
|
-
// — and that store is written from ANOTHER `useLayoutEffect` (Transitioner).
|
|
366
|
-
// So the reset necessarily lands one commit after the one that mounts these
|
|
367
|
-
// skeletons, and React flushes this commit's passive effects before starting
|
|
368
|
-
// that follow-up render. Verified ordering: observe → scroll reset.
|
|
369
|
-
//
|
|
370
|
-
// Observing synchronously therefore evaluates intersection against the stale
|
|
371
|
-
// scroll offset: a user navigating from the bottom of a long page has every
|
|
372
|
-
// skeleton "in view" at once, so every deferred section fires its serverFn
|
|
373
|
-
// POST simultaneously on commit — the exact thundering herd deferral exists
|
|
374
|
-
// to avoid. One frame is enough to let the reset apply.
|
|
375
|
-
//
|
|
376
|
-
// `triggered` is re-checked inside, so a section that resolved from cache in
|
|
377
|
-
// the meantime never starts an observer.
|
|
378
|
-
if (typeof requestAnimationFrame === "undefined") {
|
|
379
|
-
startObserving();
|
|
380
|
-
return () => observer?.disconnect();
|
|
381
|
-
}
|
|
382
|
-
const raf = requestAnimationFrame(startObserving);
|
|
383
|
-
return () => {
|
|
384
|
-
cancelAnimationFrame(raf);
|
|
385
|
-
observer?.disconnect();
|
|
386
|
-
};
|
|
387
|
-
}, [deferred.component, deferred.index, deferred.propsHash, pagePath, pageUrl, section, loadFn]);
|
|
388
|
-
|
|
389
|
-
if (error) {
|
|
390
|
-
const errFallback = loadedOptions?.errorFallback
|
|
391
|
-
? createElement(loadedOptions.errorFallback, { error })
|
|
392
|
-
: errorFallback;
|
|
393
|
-
return <>{errFallback ?? null}</>;
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
if (section) {
|
|
397
|
-
const sectionId = section.key
|
|
398
|
-
.replace(/\//g, "-")
|
|
399
|
-
.replace(/\.tsx$/, "")
|
|
400
|
-
.replace(/^site-sections-/, "");
|
|
401
|
-
|
|
402
|
-
// Sync path: render directly without Suspense. React 19 SSR streaming
|
|
403
|
-
// omits the <!--$--> markers when a Suspense boundary resolves sync,
|
|
404
|
-
// which then triggers a hydration mismatch (minified error #418).
|
|
405
|
-
// See also the matching bifurcation in the main render path and the
|
|
406
|
-
// Await-resolved path elsewhere in this file.
|
|
407
|
-
const SyncComp = getSyncComponent(section.component);
|
|
408
|
-
if (SyncComp) {
|
|
409
|
-
return (
|
|
410
|
-
<section
|
|
411
|
-
id={sectionId}
|
|
412
|
-
data-manifest-key={section.key}
|
|
413
|
-
style={{ animation: "decoFadeIn 0.3s ease-out" }}
|
|
414
|
-
>
|
|
415
|
-
<SectionErrorBoundary sectionKey={section.key} fallback={errorFallback}>
|
|
416
|
-
{createElement(SyncComp, section.props)}
|
|
417
|
-
</SectionErrorBoundary>
|
|
418
|
-
</section>
|
|
419
|
-
);
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
const LazyComponent = getLazyComponent(section.component);
|
|
423
|
-
if (!LazyComponent) return null;
|
|
424
|
-
|
|
425
|
-
return (
|
|
426
|
-
<section
|
|
427
|
-
id={sectionId}
|
|
428
|
-
data-manifest-key={section.key}
|
|
429
|
-
style={{ animation: "decoFadeIn 0.3s ease-out" }}
|
|
430
|
-
>
|
|
431
|
-
<SectionErrorBoundary sectionKey={section.key} fallback={errorFallback}>
|
|
432
|
-
<Suspense fallback={skeleton}>
|
|
433
|
-
<LazyComponent {...section.props} />
|
|
434
|
-
</Suspense>
|
|
435
|
-
</SectionErrorBoundary>
|
|
436
|
-
</section>
|
|
437
|
-
);
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
const sectionId = deferred.key
|
|
441
|
-
.replace(/\//g, "-")
|
|
442
|
-
.replace(/\.tsx$/, "")
|
|
443
|
-
.replace(/^site-sections-/, "");
|
|
444
|
-
|
|
445
|
-
// Wrap in the same SectionErrorBoundary the resolved branches use above.
|
|
446
|
-
// Without this, the child at this position goes straight from `skeleton`
|
|
447
|
-
// to `<SectionErrorBoundary>...</SectionErrorBoundary>` once `section` is
|
|
448
|
-
// set — a type change React can't reconcile, forcing a full unmount of
|
|
449
|
-
// the skeleton subtree and mount of the resolved subtree even when the
|
|
450
|
-
// section's own LoadingFallback renders the real component with reduced
|
|
451
|
-
// props (a documented convention — see Footer.tsx/ETCImageContent.tsx in
|
|
452
|
-
// a production storefront migration's T64). That unmount/remount is what
|
|
453
|
-
// produces a hard rect-collapse-to-{0,0,0,0} layout-shift entry instead
|
|
454
|
-
// of an ordinary prop-driven resize. Keeping the wrapper identical across
|
|
455
|
-
// both branches lets React diff by type at the child position instead.
|
|
456
|
-
return (
|
|
457
|
-
<section ref={ref} id={sectionId} data-manifest-key={deferred.key} data-deferred="true">
|
|
458
|
-
<SectionErrorBoundary sectionKey={deferred.key} fallback={errorFallback}>
|
|
459
|
-
{skeleton}
|
|
460
|
-
</SectionErrorBoundary>
|
|
461
|
-
</section>
|
|
462
|
-
);
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
// ---------------------------------------------------------------------------
|
|
466
|
-
// DeferredSectionSkeleton — resolves the best fallback for a deferred section
|
|
467
|
-
// ---------------------------------------------------------------------------
|
|
468
|
-
|
|
469
|
-
function DeferredSectionSkeleton({
|
|
470
|
-
deferred,
|
|
471
|
-
fallback,
|
|
472
|
-
}: {
|
|
473
|
-
deferred: DeferredSection;
|
|
474
|
-
fallback?: ReactNode;
|
|
475
|
-
}) {
|
|
476
|
-
const options = getSectionOptions(deferred.component);
|
|
477
|
-
if (options?.loadingFallback) {
|
|
478
|
-
// rawProps are no longer serialized to the client — pass empty object.
|
|
479
|
-
// LoadingFallback components should be pure layout skeletons.
|
|
480
|
-
return createElement(options.loadingFallback, deferred.rawProps ?? {});
|
|
481
|
-
}
|
|
482
|
-
if (fallback) return <>{fallback}</>;
|
|
483
|
-
if (isDev) return <DevMissingFallbackWarning component={deferred.component} />;
|
|
484
|
-
return <DefaultSectionFallback />;
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
// ---------------------------------------------------------------------------
|
|
488
|
-
// Merge helper — combines eager and deferred sections in original order
|
|
489
|
-
// ---------------------------------------------------------------------------
|
|
490
|
-
|
|
491
|
-
type PageItem =
|
|
492
|
-
| { type: "eager"; section: ResolvedSection; originalIndex: number }
|
|
493
|
-
| { type: "deferred"; deferred: DeferredSection };
|
|
494
|
-
|
|
495
|
-
function mergeSections(resolved: ResolvedSection[], deferred: DeferredSection[]): PageItem[] {
|
|
496
|
-
if (!resolved?.length && !deferred?.length) return [];
|
|
497
|
-
const safeResolved = resolved ?? [];
|
|
498
|
-
const safeDeferred = deferred ?? [];
|
|
499
|
-
|
|
500
|
-
if (!safeDeferred.length) {
|
|
501
|
-
return safeResolved.map((s, i) => ({ type: "eager", section: s, originalIndex: i }));
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
// Use the `index` property stamped by resolveDecoPage to sort all
|
|
505
|
-
// sections (eager + deferred) back into their original CMS order.
|
|
506
|
-
const items: (PageItem & { _sort: number })[] = [];
|
|
507
|
-
|
|
508
|
-
for (let i = 0; i < safeResolved.length; i++) {
|
|
509
|
-
const s = safeResolved[i];
|
|
510
|
-
items.push({ type: "eager", section: s, originalIndex: i, _sort: s.index ?? i });
|
|
511
|
-
}
|
|
512
|
-
|
|
513
|
-
for (const d of safeDeferred) {
|
|
514
|
-
items.push({ type: "deferred", deferred: d, _sort: d.index } as PageItem & { _sort: number });
|
|
515
|
-
}
|
|
516
|
-
|
|
517
|
-
items.sort((a, b) => a._sort - b._sort);
|
|
518
|
-
|
|
519
|
-
return items;
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
// ---------------------------------------------------------------------------
|
|
523
|
-
// DecoPageRenderer — renders top-level resolved sections from a CMS page
|
|
524
|
-
// ---------------------------------------------------------------------------
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
interface Props {
|
|
528
|
-
sections: ResolvedSection[];
|
|
529
|
-
deferredSections?: DeferredSection[];
|
|
530
|
-
/**
|
|
531
|
-
* Unawaited promises for deferred sections, keyed by `d_<index>`.
|
|
532
|
-
* Created by the route loader for TanStack native SSR streaming.
|
|
533
|
-
* When provided, takes precedence over `loadDeferredSectionFn`.
|
|
534
|
-
*
|
|
535
|
-
* SSR-ONLY: promises cannot cross the server-fn JSON boundary, so a client
|
|
536
|
-
* (SPA) navigation never receives them. Any site that defers sections needs
|
|
537
|
-
* `loadDeferredSectionFn` wired regardless — it is the only path that works
|
|
538
|
-
* for both SSR and client nav.
|
|
539
|
-
*/
|
|
540
|
-
deferredPromises?: Record<string, Promise<ResolvedSection | null>>;
|
|
541
|
-
pagePath?: string;
|
|
542
|
-
/** Original page URL (with query params) — forwarded to deferred section loaders. */
|
|
543
|
-
pageUrl?: string;
|
|
544
|
-
/**
|
|
545
|
-
* Server-resolved device, serialized into the page loader data. When set, it
|
|
546
|
-
* seeds `DeviceProvider` so client hydration reads the exact value the server
|
|
547
|
-
* used — making `useDevice()` hydration-stable. Omit to fall back to runtime
|
|
548
|
-
* resolution (backward compatible).
|
|
549
|
-
*/
|
|
550
|
-
device?: Device;
|
|
551
|
-
loadingFallback?: ReactNode;
|
|
552
|
-
errorFallback?: ReactNode;
|
|
553
|
-
/**
|
|
554
|
-
* IntersectionObserver-driven loader for deferred sections — wire this to
|
|
555
|
-
* `deferredSectionLoader` from `@decocms/tanstack`.
|
|
556
|
-
*
|
|
557
|
-
* NOT deprecated: `deferredPromises` only covers SSR (promises can't be
|
|
558
|
-
* serialized through a server fn), so this is the only deferred-resolution
|
|
559
|
-
* path available on a client (SPA) navigation. Without it, deferred sections
|
|
560
|
-
* on a SPA transition render a skeleton that never resolves.
|
|
561
|
-
*/
|
|
562
|
-
loadDeferredSectionFn?: (data: {
|
|
563
|
-
component: string;
|
|
564
|
-
rawProps?: Record<string, unknown>;
|
|
565
|
-
pagePath: string;
|
|
566
|
-
pageUrl?: string;
|
|
567
|
-
index?: number;
|
|
568
|
-
}) => Promise<ResolvedSection | null>;
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
export function DecoPageRenderer({
|
|
572
|
-
sections,
|
|
573
|
-
deferredSections,
|
|
574
|
-
deferredPromises,
|
|
575
|
-
pagePath = "/",
|
|
576
|
-
pageUrl,
|
|
577
|
-
device,
|
|
578
|
-
loadingFallback,
|
|
579
|
-
errorFallback,
|
|
580
|
-
loadDeferredSectionFn,
|
|
581
|
-
}: Props) {
|
|
582
|
-
const items = mergeSections(sections ?? [], deferredSections ?? []);
|
|
583
|
-
const hasDeferred = deferredSections && deferredSections.length > 0;
|
|
584
|
-
|
|
585
|
-
// Seed DeviceProvider with the server-resolved `device` from the page loader
|
|
586
|
-
// (serialized into the hydration payload). Both the SSR render and client
|
|
587
|
-
// hydration then read the SAME value, instead of the client re-resolving via
|
|
588
|
-
// navigator.userAgent and descendants re-reading AsyncLocalStorage — which is
|
|
589
|
-
// lost across streaming-SSR Suspense boundaries and silently falls back to
|
|
590
|
-
// "desktop", causing React #418 hydration mismatches (#278, #231). When
|
|
591
|
-
// `device` is absent (custom roots), DeviceProvider falls back to runtime
|
|
592
|
-
// resolution.
|
|
593
|
-
return (
|
|
594
|
-
<DeviceProvider value={device}>
|
|
595
|
-
{hasDeferred && <FadeInStyle />}
|
|
596
|
-
{items.map((item, index) => {
|
|
597
|
-
if (item.type === "deferred") {
|
|
598
|
-
const promiseKey = `d_${item.deferred.index}`;
|
|
599
|
-
const promise = deferredPromises?.[promiseKey];
|
|
600
|
-
|
|
601
|
-
// TanStack native streaming path — uses <Await> for SSR-streamed data
|
|
602
|
-
if (promise) {
|
|
603
|
-
const deferredSectionId = item.deferred.key
|
|
604
|
-
.replace(/\//g, "-")
|
|
605
|
-
.replace(/\.tsx$/, "")
|
|
606
|
-
.replace(/^site-sections-/, "");
|
|
607
|
-
|
|
608
|
-
return (
|
|
609
|
-
<SectionErrorBoundary
|
|
610
|
-
key={`deferred-${pagePath}-${item.deferred.key}-${item.deferred.index}`}
|
|
611
|
-
sectionKey={item.deferred.key}
|
|
612
|
-
fallback={errorFallback}
|
|
613
|
-
>
|
|
614
|
-
<Suspense fallback={
|
|
615
|
-
<section id={deferredSectionId} data-manifest-key={item.deferred.key} data-deferred="true">
|
|
616
|
-
<DeferredSectionSkeleton deferred={item.deferred} fallback={loadingFallback} />
|
|
617
|
-
</section>
|
|
618
|
-
}>
|
|
619
|
-
<Await promise={promise}>
|
|
620
|
-
{(resolved) => {
|
|
621
|
-
if (!resolved) return null;
|
|
622
|
-
const resolvedOptions = getSectionOptions(resolved.component);
|
|
623
|
-
const isClientOnly = resolvedOptions?.clientOnly === true;
|
|
624
|
-
const SyncComp = getSyncComponent(resolved.component);
|
|
625
|
-
const sectionId = resolved.key
|
|
626
|
-
.replace(/\//g, "-")
|
|
627
|
-
.replace(/\.tsx$/, "")
|
|
628
|
-
.replace(/^site-sections-/, "");
|
|
629
|
-
|
|
630
|
-
let inner: ReactNode;
|
|
631
|
-
|
|
632
|
-
if (SyncComp && !isClientOnly) {
|
|
633
|
-
// Sync path: direct render, no lazy/Suspense.
|
|
634
|
-
inner = createElement(SyncComp, resolved.props);
|
|
635
|
-
} else {
|
|
636
|
-
const LazyComponent = getLazyComponent(resolved.component);
|
|
637
|
-
if (!LazyComponent) return null;
|
|
638
|
-
|
|
639
|
-
const fallbackEl = resolvedOptions?.loadingFallback
|
|
640
|
-
? createElement(resolvedOptions.loadingFallback, resolved.props)
|
|
641
|
-
: null;
|
|
642
|
-
|
|
643
|
-
inner = isClientOnly ? (
|
|
644
|
-
<ClientOnly fallback={fallbackEl}>
|
|
645
|
-
<Suspense fallback={null}>
|
|
646
|
-
<LazyComponent {...resolved.props} />
|
|
647
|
-
</Suspense>
|
|
648
|
-
</ClientOnly>
|
|
649
|
-
) : (
|
|
650
|
-
<Suspense fallback={null}>
|
|
651
|
-
<LazyComponent {...resolved.props} />
|
|
652
|
-
</Suspense>
|
|
653
|
-
);
|
|
654
|
-
}
|
|
655
|
-
|
|
656
|
-
return (
|
|
657
|
-
<section
|
|
658
|
-
id={sectionId}
|
|
659
|
-
data-manifest-key={resolved.key}
|
|
660
|
-
style={{ animation: "decoFadeIn 0.3s ease-out" }}
|
|
661
|
-
>
|
|
662
|
-
{inner}
|
|
663
|
-
</section>
|
|
664
|
-
);
|
|
665
|
-
}}
|
|
666
|
-
</Await>
|
|
667
|
-
</Suspense>
|
|
668
|
-
</SectionErrorBoundary>
|
|
669
|
-
);
|
|
670
|
-
}
|
|
671
|
-
|
|
672
|
-
// Fallback: legacy POST-based IntersectionObserver path
|
|
673
|
-
if (loadDeferredSectionFn) {
|
|
674
|
-
return (
|
|
675
|
-
<DeferredSectionWrapper
|
|
676
|
-
key={`deferred-${pagePath}-${item.deferred.key}-${item.deferred.index}`}
|
|
677
|
-
deferred={item.deferred}
|
|
678
|
-
pagePath={pagePath}
|
|
679
|
-
pageUrl={pageUrl}
|
|
680
|
-
loadingFallback={loadingFallback}
|
|
681
|
-
errorFallback={errorFallback}
|
|
682
|
-
loadFn={loadDeferredSectionFn}
|
|
683
|
-
/>
|
|
684
|
-
);
|
|
685
|
-
}
|
|
686
|
-
return null;
|
|
687
|
-
}
|
|
688
|
-
|
|
689
|
-
const { section } = item;
|
|
690
|
-
|
|
691
|
-
const options = getSectionOptions(section.component);
|
|
692
|
-
const errFallback = options?.errorFallback
|
|
693
|
-
? createElement(options.errorFallback, { error: new Error("") })
|
|
694
|
-
: errorFallback;
|
|
695
|
-
|
|
696
|
-
const sectionId = section.key
|
|
697
|
-
.replace(/\//g, "-")
|
|
698
|
-
.replace(/\.tsx$/, "")
|
|
699
|
-
.replace(/^site-sections-/, "");
|
|
700
|
-
|
|
701
|
-
const isClientOnly = options?.clientOnly === true;
|
|
702
|
-
const SyncComponent = getSyncComponent(section.component);
|
|
703
|
-
|
|
704
|
-
let content: ReactNode;
|
|
705
|
-
|
|
706
|
-
if (SyncComponent && !isClientOnly) {
|
|
707
|
-
// Sync path: render directly — no Suspense, no lazy.
|
|
708
|
-
// React SSR streaming ignores syncThenable's pre-fulfilled status
|
|
709
|
-
// and creates empty <template> placeholders. Direct createElement avoids this.
|
|
710
|
-
content = createElement(SyncComponent, section.props);
|
|
711
|
-
} else {
|
|
712
|
-
const LazyComponent = getLazyComponent(section.component);
|
|
713
|
-
if (!LazyComponent) return null;
|
|
714
|
-
|
|
715
|
-
const fallbackEl = options?.loadingFallback
|
|
716
|
-
? createElement(options.loadingFallback, section.props)
|
|
717
|
-
: null;
|
|
718
|
-
|
|
719
|
-
content = isClientOnly ? (
|
|
720
|
-
<ClientOnly fallback={fallbackEl}>
|
|
721
|
-
<Suspense fallback={null}>
|
|
722
|
-
<LazyComponent {...section.props} />
|
|
723
|
-
</Suspense>
|
|
724
|
-
</ClientOnly>
|
|
725
|
-
) : (
|
|
726
|
-
<Suspense fallback={null}>
|
|
727
|
-
<LazyComponent {...section.props} />
|
|
728
|
-
</Suspense>
|
|
729
|
-
);
|
|
730
|
-
}
|
|
731
|
-
|
|
732
|
-
// Dev warning: eager section not sync-registered may blank during hydration
|
|
733
|
-
if (isDev && !isClientOnly && !getSyncComponent(section.component)) {
|
|
734
|
-
console.warn(
|
|
735
|
-
`[DecoPageRenderer] Eager section "${section.component}" is not in registerSectionsSync(). ` +
|
|
736
|
-
`This may cause blank content during hydration. Add it to registerSectionsSync() in setup.ts.`,
|
|
737
|
-
);
|
|
738
|
-
}
|
|
739
|
-
|
|
740
|
-
return (
|
|
741
|
-
<section key={`${section.key}-${index}`} id={sectionId} data-manifest-key={section.key}>
|
|
742
|
-
<SectionErrorBoundary sectionKey={section.key} fallback={errFallback}>
|
|
743
|
-
{content}
|
|
744
|
-
</SectionErrorBoundary>
|
|
745
|
-
</section>
|
|
746
|
-
);
|
|
747
|
-
})}
|
|
748
|
-
</DeviceProvider>
|
|
749
|
-
);
|
|
750
|
-
}
|