Slice Machine v1.25.0 Release Notes

Hey! :wave:

We're happy to announce the release of Slice Machine v1.25.0!

:art: Enhancements

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.

1 Like