(props: {
dataPath: Array<string>
activeQuery: Query
value: boolean
})
| 186 | } |
| 187 | |
| 188 | const ToggleValueButton = (props: { |
| 189 | dataPath: Array<string> |
| 190 | activeQuery: Query |
| 191 | value: boolean |
| 192 | }) => { |
| 193 | const theme = useTheme() |
| 194 | const themed = createThemed(theme) |
| 195 | const queryClient = useQueryDevtoolsContext().client |
| 196 | |
| 197 | return ( |
| 198 | <button |
| 199 | class={`${themed('tsqd-style-explorer-action-button')} tsqd-style-explorer-toggle-button`} |
| 200 | title={'Toggle value'} |
| 201 | aria-label={'Toggle value'} |
| 202 | aria-pressed={props.value} |
| 203 | onClick={() => { |
| 204 | const oldData = props.activeQuery.state.data |
| 205 | const newData = updateNestedDataByPath( |
| 206 | oldData, |
| 207 | props.dataPath, |
| 208 | !props.value, |
| 209 | ) |
| 210 | queryClient.setQueryData(props.activeQuery.queryKey, newData) |
| 211 | }} |
| 212 | > |
| 213 | <Check theme={theme()} checked={props.value} /> |
| 214 | </button> |
| 215 | ) |
| 216 | } |
| 217 | |
| 218 | type ExplorerProps = { |
| 219 | editable?: boolean |
nothing calls this directly
no test coverage detected