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