Skip to content

storyblok-preview setup

ContentPreviewProvider

Registers the Storyblok bridge and re-renders the route when the editor pushes a story.

import { ContentPreviewProvider } from "@evolve-storefront/storyblok-preview/provider";
Design notes

Also stamps the data-blok-* attributes the editor needs to make a block clickable. Those are derived from the data-component-id / data-component-type pairs storyblokDataAttributes puts on each block, so a page gets them by wrapping its registry rather than by every component knowing about Storyblok.

PropTypeDescription
childrenReactNode
storeContentHandler(cb?: (() => void) | undefined) => (data: unknown) => Promise<void>

Handles a story the editor pushed. A Next server action that revalidates the route: the page is server-rendered, so new content has to come back from the server rather than from local state.

More

It is called with an optional callback to run once the store has settled.

resolveRelations?string[]

Story fields whose relations the bridge should resolve, by <component>.<field> or field name.

More

The project's content model decides this — a package cannot know which of your fields are relations, and the bridge sends unresolved ids for any you leave out.