React Suspense in placeholders

Version:

Previously, <Suspense> was enabled by default, wrapping all components rendered within a <Placeholder>. This behavior has been identified as a source of increased JavaScript scripting execution time and Suspense is now opt-in rather than opt-out for apps based on Content SDK v2.0 and higher.

Important

The disableSuspense prop has been deprecated and will be removed in the next major release.

React Suspense configuration

React Suspense handles asynchronous rendering, but wrapping every component in a placeholder with a Suspense boundary, regardless of whether it is needed, adds measurable overhead. To overcome this, the default behavior of the disableSuspense prop is now inverted on the Placeholder component.

The default value was previously false, meaning Suspense was always applied. This is now true, and it skips Suspense unless you explicitly opt in.

This change affects the ErrorBoundary component internally, which was updated to treat a missing disableSuspense prop as true using a nullish coalescing check (?? true).

If your components rely on Suspense for lazy loading or async data fetching inside a placeholder, you can re-enable the previous behavior by passing disableSuspense={false} explicitly:

<Placeholder name="main" rendering={route} disableSuspense={false} />

Similarly, if you use ErrorBoundary directly and want Suspense fallback behavior:

<ErrorBoundary disableSuspense={false} componentLoadingMessage="Loading..."> 
  <MyLazyComponent /> 
</ErrorBoundary>

Changes to edit mode

Since Suspense is now universally disabled by default, the logic that automatically disabled Suspense when the Sitecore page state was set to LayoutServicePageState.Edit in the <PlaceholderCommon> component has been removed, simplifying the internal rendering logic.

If you have suggestions for improving this article, let us know!