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

Function DeleteItemButton

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

Source from the content-addressed store, hash-verified

162}
163
164const DeleteItemButton = (props: {
165 dataPath: Array<string>
166 activeQuery: Query
167}) => {
168 const theme = useTheme()
169 const themed = createThemed(theme)
170 const queryClient = useQueryDevtoolsContext().client
171
172 return (
173 <button
174 class={themed('tsqd-style-explorer-action-button')}
175 title={'Delete item'}
176 aria-label={'Delete item'}
177 onClick={() => {
178 const oldData = props.activeQuery.state.data
179 const newData = deleteNestedDataByPath(oldData, props.dataPath)
180 queryClient.setQueryData(props.activeQuery.queryKey, newData)
181 }}
182 >
183 <Trash />
184 </button>
185 )
186}
187
188const ToggleValueButton = (props: {
189 dataPath: Array<string>

Callers

nothing calls this directly

Calls 5

useThemeFunction · 0.90
createThemedFunction · 0.90
useQueryDevtoolsContextFunction · 0.90
deleteNestedDataByPathFunction · 0.90
setQueryDataMethod · 0.45

Tested by

no test coverage detected