Shipped/Regular release update June 10th, 2024

June 10, 2024

Regular release update June 10th, 2024

SDK

  • New packages 19.159.0 with updated support for Next.js App Router.

App Router / React Server Components SDK updates

  • Support for <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.
resolveComponent={({ component }) => { let result: ResolveComponentResult['component'] | undefined = undefined; let suspense: ResolveComponentResult['suspense'] | undefined = undefined; if (component.type === 'page') { result = PageComponent; suspense = { fallback: () => <div>Loading...</div>, }; } return { component: result ?? DefaultNotImplementedComponent, suspense, }; }}
  • Additional API: retrieve compositions by slug: A helper function was introduced to fetch compositions by slug instead of by route path. This function can be useful when you are trying to retrieve a composition that is not associated with the current one but still want to benefit from built in cache logic.
import { retrieveCompositionBySlug } from '@uniformdev/canvas-next-rsc'; // somewhere in your component const composition = await retrieveCompositionBySlug({ slug: 'composition-slug-here' });
  • Cache optimization: route fetch requests have been optimized and requests without data in Next.js Data Cache will fall back to Uniforms CDN cache as a second layer. This will improve performance of any cache misses that occur.
  • Next.js 15 RC support: new major version of Next.js is coming, see changelog is available here. This update to Uniform SDK is putting the foundational support for this upcoming release. As part of Next.js 15, the default fetch cache strategy will be changing, which you can read about here. In short, fetch requests are no longer cached by default. Uniform exports and uses the following API clients in the @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

  • prevent redirect loop when locale URL equals fallback
FeaturesImprovements