MCPcopy Create free account
hub / github.com/TanStack/query / DeleteItemButton

Function DeleteItemButton

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

Source from the content-addressed store, hash-verified

183}
184
185const DeleteItemButton = (props: {
186 dataPath: Array<string>
187 activeQuery: Query
188}) => {
189 const theme = useTheme()
190 const css = useQueryDevtoolsContext().shadowDOMTarget
191 ? goober.css.bind({ target: useQueryDevtoolsContext().shadowDOMTarget })
192 : goober.css
193 const styles = createMemo(() => {
194 return theme() === 'dark' ? darkStyles(css) : lightStyles(css)
195 })
196 const queryClient = useQueryDevtoolsContext().client
197
198 return (
199 <button
200 class={cx(styles().actionButton)}
201 title={'Delete item'}
202 aria-label={'Delete item'}
203 onClick={() => {
204 const oldData = props.activeQuery.state.data
205 const newData = deleteNestedDataByPath(oldData, props.dataPath)
206 queryClient.setQueryData(props.activeQuery.queryKey, newData)
207 }}
208 >
209 <Trash />
210 </button>
211 )
212}
213
214const ToggleValueButton = (props: {
215 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