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

Function ObjectValue

packages/devtools-ui/src/components/tree.tsx:237–352  ·  view source on GitHub ↗
(props: {
  value: Record<string, any>
  keyName?: string
  copyable?: boolean
  defaultExpansionDepth: number
  depth: number
  collapsePaths?: Array<string>
  path: string
  config?: { dateFormat?: string }
})

Source from the content-addressed store, hash-verified

235 defaultExpansionDepth={props.defaultExpansionDepth}
236 depth={props.depth + 1}
237 collapsePaths={props.collapsePaths}
238 path={props.path ? `${props.path}[${i()}]` : `[${i()}]`}
239 config={props.config}
240 />
241 )
242 }}
243 </For>
244 </span>
245 </Show>
246
247 <Show when={!expanded()}>
248 <span
249 data-tsd-syntax="comment"
250 onClick={(e) => {
251 e.stopPropagation()
252 e.stopImmediatePropagation()
253 setExpanded(!expanded())
254 }}
255 class={clsx(styles().tree.valueKey, styles().tree.collapsible)}
256 >
257 {`...`}
258 </span>
259 </Show>
260 <span data-tsd-syntax="punctuation" class={styles().tree.valueBraces}>
261 ]
262 </span>
263 </span>
264 </Show>
265 )
266}
267
268const ObjectValue = (props: {
269 value: Record<string, any>
270 keyName?: string
271 copyable?: boolean
272 defaultExpansionDepth: number
273 depth: number
274 collapsePaths?: Array<string>
275 path: string
276 config?: { dateFormat?: string }
277}) => {
278 const styles = createStyles()
279
280 const [expanded, setExpanded] = createSignal(
281 () =>
282 props.depth <= props.defaultExpansionDepth &&
283 !props.collapsePaths?.includes(props.path),
284 )
285
286 const keys = createMemo(() => Object.keys(props.value))
287 const lastKeyName = () => keys()[keys().length - 1]
288
289 return (
290 <Switch
291 fallback={
292 <span class={styles().tree.expanderContainer}>
293 {props.keyName && (
294 <Expander

Callers

nothing calls this directly

Calls 1

createStylesFunction · 0.90

Tested by

no test coverage detected