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