@decocms/start 0.27.1 → 0.27.3
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
CHANGED
|
@@ -172,8 +172,17 @@ export function SectionRenderer({ section }: { section: Section | null | undefin
|
|
|
172
172
|
return null;
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
+
// Use the section's registered loadingFallback (if available) instead of
|
|
176
|
+
// the generic NestedSectionFallback. This lets parent sections (e.g.
|
|
177
|
+
// NotFoundChallenge) show a meaningful skeleton for nested children
|
|
178
|
+
// (e.g. MountedPDP) while the lazy chunk loads.
|
|
179
|
+
const options = getSectionOptions(section.Component);
|
|
180
|
+
const fallback = options?.loadingFallback
|
|
181
|
+
? createElement(options.loadingFallback, section.props ?? {})
|
|
182
|
+
: <NestedSectionFallback />;
|
|
183
|
+
|
|
175
184
|
return (
|
|
176
|
-
<Suspense fallback={
|
|
185
|
+
<Suspense fallback={fallback}>
|
|
177
186
|
<Lazy {...(section.props ?? {})} />
|
|
178
187
|
</Suspense>
|
|
179
188
|
);
|
|
@@ -231,8 +240,11 @@ function DeferredSectionWrapper({
|
|
|
231
240
|
getSectionOptions(deferred.component),
|
|
232
241
|
);
|
|
233
242
|
const isSSR = typeof document === "undefined";
|
|
243
|
+
// Allow SSR to render the loadingFallback when registered sync via
|
|
244
|
+
// registerSection(). Previous `isSSR ? false` always returned null,
|
|
245
|
+
// hiding the skeleton from the HTML stream.
|
|
234
246
|
const [optionsReady, setOptionsReady] = useState(() =>
|
|
235
|
-
|
|
247
|
+
!!getSectionOptions(deferred.component),
|
|
236
248
|
);
|
|
237
249
|
const ref = useRef<HTMLDivElement>(null);
|
|
238
250
|
const triggered = useRef(false);
|