Skip to content

Commit 9e7889a

Browse files
committed
fix: cleanup
1 parent 299d849 commit 9e7889a

File tree

2 files changed

+9
-81
lines changed

2 files changed

+9
-81
lines changed

packages/devtools/src/context/dropzone-context.tsx

Lines changed: 0 additions & 60 deletions
This file was deleted.

packages/react-devtools/src/devtools.tsx

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,13 @@ export interface TanStackDevtoolsReactInit {
9595

9696
const convertRender = (
9797
Component: PluginRender,
98-
setComponent: React.Dispatch<React.SetStateAction<JSX.Element | null>>,
98+
setComponents: React.Dispatch<React.SetStateAction<Array<JSX.Element>>>,
9999
e: HTMLElement,
100100
theme: 'dark' | 'light',
101101
) => {
102-
setComponent(
103-
typeof Component === 'function' ? Component(e, theme) : Component,
104-
)
102+
const element =
103+
typeof Component === 'function' ? Component(e, theme) : Component
104+
setComponents((prev) => [...prev, element])
105105
}
106106

107107
export const TanStackDevtools = ({
@@ -130,41 +130,29 @@ export const TanStackDevtools = ({
130130
name:
131131
typeof plugin.name === 'string'
132132
? plugin.name
133-
: // The check above confirms that `plugin.name` is of Render type
134-
(e, theme) => {
133+
: (e, theme) => {
135134
const target = e.ownerDocument.getElementById(
136-
// @ts-ignore just testing
137-
`${PLUGIN_TITLE_CONTAINER_ID}-${generatePluginId(plugin, index)}`,
135+
`${PLUGIN_TITLE_CONTAINER_ID}-${generatePluginId(plugin as TanStackDevtoolsPlugin, index)}`,
138136
)
139137
if (target) {
140138
setTitleContainers((prev) => [...prev, target])
141139
}
142140
convertRender(
143141
plugin.name as PluginRender,
144-
(newVal) =>
145-
// @ts-ignore just testing
146-
setTitleComponents((prev) => [...prev, newVal]),
142+
setTitleComponents,
147143
e,
148144
theme,
149145
)
150146
},
151147
render: (e, theme) => {
152148
const target = e.ownerDocument.getElementById(
153-
// @ts-ignore just testing
154-
`${PLUGIN_CONTAINER_ID}-${generatePluginId(plugin, index)}`,
149+
`${PLUGIN_CONTAINER_ID}-${generatePluginId(plugin as TanStackDevtoolsPlugin, index)}`,
155150
)
156151
if (target) {
157152
setPluginContainers((prev) => [...prev, target])
158153
}
159154

160-
convertRender(
161-
plugin.render,
162-
(newVal) =>
163-
// @ts-ignore just testing
164-
setPluginComponents((prev) => [...prev, newVal]),
165-
e,
166-
theme,
167-
)
155+
convertRender(plugin.render, setPluginComponents, e, theme)
168156
},
169157
}
170158
}),

0 commit comments

Comments
 (0)