MCPcopy Index your code
hub / github.com/TanStack/devtools / TanStackDevtools

Function TanStackDevtools

packages/react-devtools/src/devtools.tsx:147–277  ·  view source on GitHub ↗
({
  plugins,
  config,
  eventBusConfig,
}: TanStackDevtoolsReactInit)

Source from the content-addressed store, hash-verified

145}
146
147export const TanStackDevtools = ({
148 plugins,
149 config,
150 eventBusConfig,
151}: TanStackDevtoolsReactInit): ReactElement | null => {
152 const devToolRef = useRef<HTMLDivElement>(null)
153
154 const [pluginContainers, setPluginContainers] = useState<
155 Record<string, HTMLElement>
156 >({})
157 const [titleContainers, setTitleContainers] = useState<
158 Record<string, HTMLElement>
159 >({})
160 const [triggerContainer, setTriggerContainer] = useState<HTMLElement | null>(
161 null,
162 )
163
164 const [PluginComponents, setPluginComponents] = useState<
165 Record<string, JSX.Element>
166 >({})
167 const [TitleComponents, setTitleComponents] = useState<
168 Record<string, JSX.Element>
169 >({})
170 const [TriggerComponent, setTriggerComponent] = useState<JSX.Element | null>(
171 null,
172 )
173
174 const pluginsMap: Array<TanStackDevtoolsPlugin> = useMemo(
175 () =>
176 plugins?.map((plugin) => {
177 return {
178 ...plugin,
179 name:
180 typeof plugin.name === 'string'
181 ? plugin.name
182 : (e, props) => {
183 const id = e.getAttribute('id')!
184 const target = e.ownerDocument.getElementById(id)
185
186 if (target) {
187 setTitleContainers((prev) => ({
188 ...prev,
189 [id]: e,
190 }))
191 }
192
193 convertRender(
194 plugin.name as PluginRender,
195 setTitleComponents,
196 e,
197 props,
198 )
199 },
200 render: (e, theme) => {
201 const id = e.getAttribute('id')!
202 const target = e.ownerDocument.getElementById(id)
203
204 if (target) {

Callers

nothing calls this directly

Calls 5

setConfigMethod · 0.80
convertRenderFunction · 0.70
convertTriggerFunction · 0.70
mountMethod · 0.45
unmountMethod · 0.45

Tested by

no test coverage detected