@decocms/start 0.29.3 → 0.30.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/package.json +1 -1
- package/src/routes/cmsRoute.ts +27 -0
- package/src/routes/index.ts +1 -0
package/package.json
CHANGED
package/src/routes/cmsRoute.ts
CHANGED
|
@@ -228,6 +228,33 @@ export const loadDeferredSection = createServerFn({ method: "POST" })
|
|
|
228
228
|
return normalizeUrlsInObject(enriched);
|
|
229
229
|
});
|
|
230
230
|
|
|
231
|
+
// ---------------------------------------------------------------------------
|
|
232
|
+
// Pre-wrapped deferred section loader for IntersectionObserver-based rendering
|
|
233
|
+
// ---------------------------------------------------------------------------
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Convenience wrapper around `loadDeferredSection` that matches the
|
|
237
|
+
* `loadDeferredSectionFn` prop signature of `DecoPageRenderer`.
|
|
238
|
+
*
|
|
239
|
+
* Pass this directly to `<DecoPageRenderer loadDeferredSectionFn={deferredSectionLoader} />`
|
|
240
|
+
* to enable IntersectionObserver-based lazy loading of deferred sections.
|
|
241
|
+
*/
|
|
242
|
+
export const deferredSectionLoader = async ({
|
|
243
|
+
component,
|
|
244
|
+
rawProps,
|
|
245
|
+
pagePath,
|
|
246
|
+
pageUrl,
|
|
247
|
+
}: {
|
|
248
|
+
component: string;
|
|
249
|
+
rawProps: Record<string, unknown>;
|
|
250
|
+
pagePath: string;
|
|
251
|
+
pageUrl?: string;
|
|
252
|
+
}): Promise<ResolvedSection | null> => {
|
|
253
|
+
return loadDeferredSection({
|
|
254
|
+
data: { component, rawProps, pagePath, pageUrl },
|
|
255
|
+
});
|
|
256
|
+
};
|
|
257
|
+
|
|
231
258
|
// ---------------------------------------------------------------------------
|
|
232
259
|
// Default pending component — shown during SPA navigation while loader runs
|
|
233
260
|
// ---------------------------------------------------------------------------
|