Testing the new slice machine simulator, I end up with a blank page (accessing directly or from the UI) even if the config is checked OK by the Slice machine UI.
I get this error in the console when accessing directly: next-dev.js?3515:32 Error: Receiver is currently not embedded as an iframe at SimulatorAPI.ready (index.js?390f:327:1) at StateManager.initAPI (index.js?0aee:181:1) at StateManager.load (index.js?0aee:145:1)
No error shown when accessing from the UI.
Framework: Next.js. All required packages were updated to latest versions.
With Slice Simulator you don't go to the /slice-simulator route you need to navigate to a Slice in the Slice Machine UI and click the "Simulate Slice" button.
import { SliceSimulator } from "@prismicio/slice-simulator-react";
import SliceZone from "next-slicezone";
import state from "../.slicemachine/libraries-state.json";
import * as Slices from "../slices";
const resolver = ({ sliceName }) => Slices[sliceName];
const SliceSimulatorPage = () => (<SliceSimulator
// The `sliceZone` prop should be a function receiving slices and rendering them using your `SliceZone` component.
sliceZone={(props) => <SliceZone {...props} resolver={resolver} />}
state={state}
/>);
export default SliceSimulatorPage;
I've just updated and am having the same issue. Seems to be a problem with the Slice resolver. I haven't dug too deep into it due to Storybook being better for us right now but it looks like an easy-ish fix.
Will report back if no one comes with a solution in the meantime.
Hey Phil, coming back to this for a sec. I found out what was happening on my side, I have two local slice libraries and the original code of /pages/slice-simulator.tsx only considers one single library called Slices. So when I tried to preview slices of this other library the resolver wouldn't find it because they weren't even being imported.