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