Skip to content

Commit

Permalink
fix: revert: refactor: remove unecessary useEffect
Browse files Browse the repository at this point in the history
  • Loading branch information
fgiuliani committed Jun 21, 2023
1 parent fd6c036 commit 738ff06
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions lib/common/client.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useState } from "react";
import { useState, useEffect } from "react";
import type { TUseStoryblokState } from "../types";
import { registerStoryblokBridge } from "@storyblok/js";

Expand All @@ -16,11 +16,14 @@ export const useStoryblokState: TUseStoryblokState = (
return initialStory;
}

registerStoryblokBridge(
story.id,
(newStory) => setStory(newStory),
bridgeOptions
);
useEffect(() => {
setStory(initialStory);
registerStoryblokBridge(
story.id,
(newStory) => setStory(newStory),
bridgeOptions
);
}, [initialStory]);

return story;
};

0 comments on commit 738ff06

Please sign in to comment.