@prismicio/slice-simulator-react Deprecation Guide

@prismicio/slice-simulator-react is deprecated. Its functionalities are now distributed through @slicemachine/adapter-next.

@prismicio/slice-simulator-react, a package providing a component to simulate Slices in Slice Machine UI and the Page Builder, is deprecated. Its functionalities are now distributed through @slicemachine/adapter-next.

Update packages in package.json

  • Remove @prismicio/slice-simulator-react from your package.json.
package.json
  {
    "devDependencies": {
-     "@prismicio/slice-simulator-react": "^0.2.0"
    }
  }
  • Update your package.json to use the latest version of @slicemachine/adapter-next.
package.json
  {
    "devDependencies": {
+     "@slicemachine/adapter-next": "^0.3.0"
    }
  }
  • Update your installed packages with npm.
npm install

Handling breaking changes

The following changes are required when upgrading your simulator to @slicemachine/adapter-next v0.

Replace imports

Replace imports for @prismicio/slice-simulator-react with @slicemachine/adapter-next/simulator on your simulator page.

./pages/slice-simulator.js
- import { SliceSimulator } from '@prismicio/slice-simulator-react'
+ import { SliceSimulator } from '@slicemachine/adapter-next/simulator'

Remove state prop if still present

The deprecated state prop from @prismicio/slice-simulator-react has been removed with @slicemachine/adapter-next. If you were still using it, you now have to remove it:

./pages/slice-simulator.js
  import { SliceSimulator } from '@slicemachine/adapter-next/simulator'
  import { SliceZone } from '@prismicio/react'

- import state from '../.slicemachine/libraries-state.json'
  import { components } from '../slices'

  const SliceSimulatorPage = () => {
    return (
      <SliceSimulator
-       state={state}
        sliceZone={(props) => <SliceZone {...props} components={components} />}
      />
    )
  }

  export default SliceSimulatorPage