Skip to content

Commit 1b10cb1

Browse files
committed
useEffect clean up in V2 by calling unsetDebug
1 parent e8c985f commit 1b10cb1

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

  • packages/react/src/modules/guide/components/Toolbar/V2

packages/react/src/modules/guide/components/Toolbar/V2/V2.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,15 @@ export const V2 = () => {
3535
const [isCollapsed, setIsCollapsed] = React.useState(true);
3636

3737
React.useEffect(() => {
38-
if (isVisible) {
39-
return client.setDebug();
38+
if (!isVisible) {
39+
return;
4040
}
4141

42-
return client.unsetDebug();
42+
client.setDebug();
43+
44+
return () => {
45+
client.unsetDebug();
46+
};
4347
}, [isVisible, client]);
4448

4549
const data = useInspectGuideClientStore();

0 commit comments

Comments
 (0)