1.25.0
angeloashmore
released this
11 Mar 09:03
·
287 commits
to main
since this release
Hey! 👋
We're happy to announce the release of Slice Machine v1.25.0!
🎨 Enhancements
- Next.js dynamic functions, like
headers()
andcookies()
, are now supported in the slice simulator.
Update your Next.js slice simulator page
If you are using Next.js with the App Router, we recommend updating your /slice-simulator
page with the following code.
After the update, your slice components can use Next.js dynamic functions.
// src/app/slice-simulator/page.tsx
import {
SliceSimulator,
SliceSimulatorParams,
getSlices,
} from "@slicemachine/adapter-next/simulator";
import { SliceZone } from "@prismicio/react";
import { components } from "@/slices";
export default function SliceSimulatorPage({
searchParams,
}: SliceSimulatorParams) {
const slices = getSlices(searchParams.state);
return (
<SliceSimulator>
<SliceZone slices={slices} components={components} />
</SliceSimulator>
);
}
Updating your page is not required, but we recommend updating it in the near future. All new Next.js projects using the App Router and bootstrapped with @slicemachine/init
will use the updated code.
Note
If you are using the Pages Router, your page does not need to be updated. The existing set up will continue to work without changes.