(props: {
dataPath: Array<string>
activeQuery: Query
})
| 146 | } |
| 147 | |
| 148 | const 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 | |
| 177 | const DeleteItemButton = (props: { |
| 178 | dataPath: Array<string> |
nothing calls this directly
no test coverage detected
searching dependent graphs…