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

Function ClearArrayButton

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

Source from the content-addressed store, hash-verified

138}
139
140const ClearArrayButton = (props: {
141 dataPath: Array<string>
142 activeQuery: Query
143}) => {
144 const theme = useTheme()
145 const themed = createThemed(theme)
146 const queryClient = useQueryDevtoolsContext().client
147
148 return (
149 <button
150 class={themed('tsqd-style-explorer-action-button')}
151 title={'Remove all items'}
152 aria-label={'Remove all items'}
153 onClick={() => {
154 const oldData = props.activeQuery.state.data
155 const newData = updateNestedDataByPath(oldData, props.dataPath, [])
156 queryClient.setQueryData(props.activeQuery.queryKey, newData)
157 }}
158 >
159 <List />
160 </button>
161 )
162}
163
164const DeleteItemButton = (props: {
165 dataPath: Array<string>

Callers

nothing calls this directly

Calls 5

useThemeFunction · 0.90
createThemedFunction · 0.90
useQueryDevtoolsContextFunction · 0.90
updateNestedDataByPathFunction · 0.90
setQueryDataMethod · 0.45

Tested by

no test coverage detected