MCPcopy Create free account
hub / github.com/TanStack/devtools / Panel

Function Panel

packages/devtools-utils/src/preact/panel.tsx:32–52  ·  view source on GitHub ↗
(props: TComponentProps)

Source from the content-addressed store, hash-verified

30 },
31>(CoreClass: new () => TCoreDevtoolsClass) {
32 function Panel(props: TComponentProps) {
33 const devToolRef = useRef<HTMLDivElement>(null)
34 const devtools = useRef<TCoreDevtoolsClass | null>(null)
35 useEffect(() => {
36 if (devtools.current) return
37 devtools.current = new CoreClass()
38 // Preact 11 clears the ref before this effect's cleanup runs.
39 const el = devToolRef.current
40
41 if (el) {
42 devtools.current.mount(el, props)
43 }
44
45 return () => {
46 if (el) {
47 devtools.current?.unmount()
48 devtools.current = null
49 }
50 }
51 }, [props])
52
53 return <div style={{ height: '100%' }} ref={devToolRef} />
54 }
55

Callers

nothing calls this directly

Calls 2

mountMethod · 0.45
unmountMethod · 0.45

Tested by

no test coverage detected