(props: {
dataPath: Array<string>
activeQuery: Query
})
| 193 | } |
| 194 | |
| 195 | const DeleteItemButton = (props: { |
| 196 | dataPath: Array<string> |
| 197 | activeQuery: Query |
| 198 | }) => { |
| 199 | const theme = useTheme() |
| 200 | const css = useQueryDevtoolsContext().shadowDOMTarget |
| 201 | ? goober.css.bind({ target: useQueryDevtoolsContext().shadowDOMTarget }) |
| 202 | : goober.css |
| 203 | const styles = createMemo(() => { |
| 204 | return theme() === 'dark' ? darkStyles(css) : lightStyles(css) |
| 205 | }) |
| 206 | const queryClient = useQueryDevtoolsContext().client |
| 207 | |
| 208 | return ( |
| 209 | <button |
| 210 | class={cx(styles().actionButton)} |
| 211 | title={'Delete item'} |
| 212 | aria-label={'Delete item'} |
| 213 | onClick={() => { |
| 214 | const oldData = props.activeQuery.state.data |
| 215 | const newData = deleteNestedDataByPath(oldData, props.dataPath) |
| 216 | queryClient.setQueryData(props.activeQuery.queryKey, newData) |
| 217 | }} |
| 218 | > |
| 219 | <Trash /> |
| 220 | </button> |
| 221 | ) |
| 222 | } |
| 223 | |
| 224 | const ToggleValueButton = (props: { |
| 225 | dataPath: Array<string> |
nothing calls this directly
no test coverage detected