Skip to content

Commit 638186d

Browse files
authored
revert panel issue (#306)
* revert panel issue * changeset
1 parent cda3fc7 commit 638186d

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

.changeset/thin-pianos-rhyme.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@tanstack/devtools-utils': patch
3+
---
4+
5+
revert panel generation

packages/devtools-utils/src/react/panel.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,18 @@ export function createReactPanel<
3232
const devToolRef = useRef<HTMLDivElement>(null)
3333
const devtools = useRef<TCoreDevtoolsClass | null>(null)
3434
useEffect(() => {
35-
const instance = new CoreClass()
36-
devtools.current = instance
35+
if (devtools.current) return
36+
37+
devtools.current = new CoreClass()
3738

3839
if (devToolRef.current) {
39-
instance.mount(devToolRef.current, props?.theme ?? 'dark')
40+
devtools.current.mount(devToolRef.current, props?.theme ?? 'dark')
4041
}
4142

4243
return () => {
43-
instance.unmount()
44-
devtools.current = null
44+
if (devToolRef.current) {
45+
devtools.current?.unmount()
46+
}
4547
}
4648
}, [props?.theme])
4749

0 commit comments

Comments
 (0)