MCPcopy Index your code
hub / github.com/TanStack/query / DeleteItemButton

Function DeleteItemButton

packages/query-devtools/src/Explorer.tsx:177–204  ·  view source on GitHub ↗
(props: {
  dataPath: Array<string>
  activeQuery: Query
})

Source from the content-addressed store, hash-verified

175}
176
177const DeleteItemButton = (props: {
178 dataPath: Array<string>
179 activeQuery: Query
180}) => {
181 const theme = useTheme()
182 const css = useQueryDevtoolsContext().shadowDOMTarget
183 ? goober.css.bind({ target: useQueryDevtoolsContext().shadowDOMTarget })
184 : goober.css
185 const styles = createMemo(() => {
186 return theme() === 'dark' ? darkStyles(css) : lightStyles(css)
187 })
188 const queryClient = useQueryDevtoolsContext().client
189
190 return (
191 <button
192 class={cx(styles().actionButton)}
193 title={'Delete item'}
194 aria-label={'Delete item'}
195 onClick={() => {
196 const oldData = props.activeQuery.state.data
197 const newData = deleteNestedDataByPath(oldData, props.dataPath)
198 queryClient.setQueryData(props.activeQuery.queryKey, newData)
199 }}
200 >
201 <Trash />
202 </button>
203 )
204}
205
206const ToggleValueButton = (props: {
207 dataPath: Array<string>

Callers

nothing calls this directly

Calls 6

useThemeFunction · 0.90
useQueryDevtoolsContextFunction · 0.90
deleteNestedDataByPathFunction · 0.90
darkStylesFunction · 0.70
lightStylesFunction · 0.70
setQueryDataMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…