MCPcopy
hub / github.com/TanStack/query / ClearArrayButton

Function ClearArrayButton

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

Source from the content-addressed store, hash-verified

146}
147
148const ClearArrayButton = (props: {
149 dataPath: Array<string>
150 activeQuery: Query
151}) => {
152 const theme = useTheme()
153 const css = useQueryDevtoolsContext().shadowDOMTarget
154 ? goober.css.bind({ target: useQueryDevtoolsContext().shadowDOMTarget })
155 : goober.css
156 const styles = createMemo(() => {
157 return theme() === 'dark' ? darkStyles(css) : lightStyles(css)
158 })
159 const queryClient = useQueryDevtoolsContext().client
160
161 return (
162 <button
163 class={styles().actionButton}
164 title={'Remove all items'}
165 aria-label={'Remove all items'}
166 onClick={() => {
167 const oldData = props.activeQuery.state.data
168 const newData = updateNestedDataByPath(oldData, props.dataPath, [])
169 queryClient.setQueryData(props.activeQuery.queryKey, newData)
170 }}
171 >
172 <List />
173 </button>
174 )
175}
176
177const DeleteItemButton = (props: {
178 dataPath: Array<string>

Callers

nothing calls this directly

Calls 6

useThemeFunction · 0.90
useQueryDevtoolsContextFunction · 0.90
updateNestedDataByPathFunction · 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…