Skip to content

Commit cf1a50c

Browse files
Remove potential hook re-ordering problem in VisualTour component
1 parent 6940791 commit cf1a50c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/components/VisualTour/VisualTour.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,6 @@ export const VisualTour = ({
7070
usableStepTarget = false,
7171
isOpen = false,
7272
}: VisualTourProps) => {
73-
if (isOpen === false) {
74-
return null;
75-
}
76-
7773
const [currentStepIndex, setCurrentStepIndex] = React.useState<number>(0);
7874
const [currentStepComponent, setCurrentStepComponent] = React.useState<React.JSX.Element | null>(null);
7975

@@ -234,7 +230,11 @@ export const VisualTour = ({
234230
};
235231
}, [currentStepIndex, usableStepTarget]);
236232

237-
return currentStepComponent;
233+
if (isOpen === false) {
234+
return null;
235+
} else {
236+
return currentStepComponent;
237+
}
238238
};
239239

240240
interface StepModalProps {

0 commit comments

Comments
 (0)