June 10, 2024
SDK
19.159.0
with updated support for Next.js App Router.App Router / React Server Components SDK updates
<Suspense />
and component streaming. Doing some async work in your server components and want to wrap the component in a Suspense boundary? Previously, you would need to handle this in your implementation but now you can let Uniform handle this for you. The resolveComponent
function on UniformComposition can now return a suspense
object to specify the component. After this is configured, this loading component will be used if your component has an uncached fetch call and the actual component will be streamed in after.1resolveComponent={({ component }) => {
2 let result: ResolveComponentResult['component'] | undefined = undefined;
3 let suspense: ResolveComponentResult['suspense'] | undefined = undefined;
4
5 if (component.type === 'page') {
6 result = PageComponent;
7 suspense = {
8 fallback: () => <div>Loading...</div>,
9 };
10 }
11
12 return {
13 component: result ?? DefaultNotImplementedComponent,
14 suspense,
15 };
16}
1import { retrieveCompositionBySlug } from '@uniformdev/canvas-next-rsc';
2
3// somewhere in your component
4const composition = await retrieveCompositionBySlug({ slug: 'composition-slug-here' });
@uniformdev/canvas-next-rsc
: getDefaultCanvasClient
, getDefaultManifestClient
, getDefaultProjectMapClient
, getDefaultRouteClient
. If you are using any of these clients, you will not see any change in caching as we always specify the cache
field used to control caching.Other bug fixes