and the state is only changed if we are in preview mode as initEventListeners runs setStory
useEffect(() => {
// only load inside preview mode
if (preview) {
// first load the bridge, then initialize the event listeners
addBridge(initEventListeners)
}
}, [])
if (data.story) {
setStory(data.story)
}
the returned story will always be the first originalStory use in
useState(originalStory)
?initialState is never overwritten.
and the state is only changed if we are in preview mode as initEventListeners runs setStory
add a useEffect to update story to originalStory?