Skip to content

Commit 599ae5c

Browse files
committed
fix: walkthrough
1 parent 9aa6e8a commit 599ae5c

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

apps/web/src/providers/WalkthroughProvider.tsx

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ type WalkthroughStep = {
5050
};
5151

5252
const Walkthrough = () => {
53-
const isDisclaimerAccepted = useAppStore((store) => store.isDisclaimerAccepted);
54-
const isWalkthroughComplete = useAppStore((store) => store.isWalkthroughComplete);
5553
const setIsWalkthroughComplete = useAppStore((store) => store.setIsWalkthroughComplete);
5654
const startSession = useAppStore((store) => store.startSession);
5755
const endSession = useAppStore((store) => store.endSession);
@@ -331,12 +329,6 @@ const Walkthrough = () => {
331329
setIsWalkthroughOpen(false);
332330
};
333331

334-
useEffect(() => {
335-
if (isDisclaimerAccepted && !isWalkthroughComplete) {
336-
setIsWalkthroughOpen(true);
337-
}
338-
}, [isDisclaimerAccepted, isWalkthroughComplete]);
339-
340332
useLayoutEffect(() => {
341333
if (window.location.pathname !== currentStep.url) {
342334
navigate(currentStep.url, currentStep.navigateOptions);
@@ -430,11 +422,22 @@ const Walkthrough = () => {
430422
};
431423

432424
export const WalkthroughProvider: React.FC<{ children: React.ReactElement }> = ({ children }) => {
425+
const isDisclaimerAccepted = useAppStore((store) => store.isDisclaimerAccepted);
433426
const isWalkthroughOpen = useAppStore((store) => store.isWalkthroughOpen);
427+
const isWalkthroughComplete = useAppStore((store) => store.isWalkthroughComplete);
428+
const setIsWalkthroughOpen = useAppStore((store) => store.setIsWalkthroughOpen);
434429
const isDesktop = useIsDesktop();
430+
431+
useEffect(() => {
432+
if (isDisclaimerAccepted && !isWalkthroughComplete) {
433+
setIsWalkthroughOpen(true);
434+
}
435+
}, [isDisclaimerAccepted, isWalkthroughComplete]);
436+
435437
if (!isDesktop) {
436438
return children;
437439
}
440+
438441
return (
439442
<React.Fragment>
440443
{children}

0 commit comments

Comments
 (0)