Skip to content

Commit

Permalink
Refactor onMoint dynamic import
Browse files Browse the repository at this point in the history
  • Loading branch information
lachlancollins committed Jul 3, 2023
1 parent 1a9c023 commit 83ca31b
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions packages/svelte-query-devtools/src/Devtools.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,23 @@
let devtools: TanstackQueryDevtools | undefined
if (DEV && BROWSER) {
onMount(async () => {
const QueryDevtools = (await import('@tanstack/query-devtools'))
.TanstackQueryDevtools
devtools = new QueryDevtools({
client,
queryFlavor: 'Svelte Query',
version: '5',
onlineManager,
buttonPosition,
position,
initialIsOpen,
errorTypes,
})
onMount(() => {
import('@tanstack/query-devtools').then((m) => {
const QueryDevtools = m.TanstackQueryDevtools
devtools = new QueryDevtools({
client,
queryFlavor: 'Svelte Query',
version: '5',
onlineManager,
buttonPosition,
position,
initialIsOpen,
errorTypes,
})
devtools.mount(ref)
devtools.mount(ref)
})
return () => {
devtools?.unmount()
Expand Down

0 comments on commit 83ca31b

Please sign in to comment.