Skip to content

Commit

Permalink
Fix reactive props
Browse files Browse the repository at this point in the history
  • Loading branch information
lachlancollins committed Jul 26, 2024
1 parent 9771a13 commit 39cbe53
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
22 changes: 20 additions & 2 deletions packages/svelte-query-devtools/src/Devtools.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
DevToolsErrorType,
DevtoolsButtonPosition,
DevtoolsPosition,
TanstackQueryDevtools,
} from '@tanstack/query-devtools'
interface DevtoolsOptions {
Expand Down Expand Up @@ -50,13 +51,14 @@
}: DevtoolsOptions = $props()
let ref: HTMLDivElement
let devtools: TanstackQueryDevtools | undefined
if (DEV && BROWSER) {
onMount(() => {
import('@tanstack/query-devtools').then((m) => {
const QueryDevtools = m.TanstackQueryDevtools
const devtools = new QueryDevtools({
devtools = new QueryDevtools({
client,
queryFlavor: 'Svelte Query',
version: '5',
Expand All @@ -69,8 +71,24 @@
})
devtools.mount(ref)
return () => devtools.unmount()
})
return () => devtools?.unmount()
})
$effect(() => {
devtools?.setButtonPosition(buttonPosition)
})
$effect(() => {
devtools?.setPosition(position)
})
$effect(() => {
devtools?.setInitialIsOpen(initialIsOpen)
})
$effect(() => {
devtools?.setErrorTypes(errorTypes)
})
}
</script>
Expand Down
1 change: 1 addition & 0 deletions packages/svelte-query/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ type Override<TTargetA, TTargetB> = {
: TTargetA[AKey]
}

/** Options for useMutationState */
export type MutationStateOptions<TResult = MutationState> = {
filters?: MutationFilters
select?: (
Expand Down

0 comments on commit 39cbe53

Please sign in to comment.