Skip to content

Commit

Permalink
fix: correct checks for useStoryblokBridge
Browse files Browse the repository at this point in the history
  • Loading branch information
alexjoverm committed Sep 13, 2022
1 parent e5fe5af commit 09a5d6b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@ export const useStoryblokBridge = <
window.storyblokRegisterEvent(() => {
const sbBridge: StoryblokBridgeV2 = new window.StoryblokBridge(options);
sbBridge.on(["input", "published", "change"], (event) => {
if (event.story.id === id) {
if (event.action === "input") cb(event.story);
else window.location.reload();
if (event.action === "input" && event.story.id === id) {
cb(event.story);
} else if (event.action === "change" || event.action === "published") {
window.location.reload();
}
});
});
Expand Down

0 comments on commit 09a5d6b

Please sign in to comment.