(props: {
dataPath: Array<string>
activeQuery: Query
})
| 164 | } |
| 165 | |
| 166 | const ClearArrayButton = (props: { |
| 167 | dataPath: Array<string> |
| 168 | activeQuery: Query |
| 169 | }) => { |
| 170 | const theme = useTheme() |
| 171 | const css = useQueryDevtoolsContext().shadowDOMTarget |
| 172 | ? goober.css.bind({ target: useQueryDevtoolsContext().shadowDOMTarget }) |
| 173 | : goober.css |
| 174 | const styles = createMemo(() => { |
| 175 | return theme() === 'dark' ? darkStyles(css) : lightStyles(css) |
| 176 | }) |
| 177 | const queryClient = useQueryDevtoolsContext().client |
| 178 | |
| 179 | return ( |
| 180 | <button |
| 181 | class={styles().actionButton} |
| 182 | title={'Remove all items'} |
| 183 | aria-label={'Remove all items'} |
| 184 | onClick={() => { |
| 185 | const oldData = props.activeQuery.state.data |
| 186 | const newData = updateNestedDataByPath(oldData, props.dataPath, []) |
| 187 | queryClient.setQueryData(props.activeQuery.queryKey, newData) |
| 188 | }} |
| 189 | > |
| 190 | <List /> |
| 191 | </button> |
| 192 | ) |
| 193 | } |
| 194 | |
| 195 | const DeleteItemButton = (props: { |
| 196 | dataPath: Array<string> |
nothing calls this directly
no test coverage detected