Skip to content

Commit

Permalink
feat: migrate to tanstack-query v5
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelhthomas committed Mar 12, 2024
1 parent 2d125bc commit 163ee07
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 17 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"dependencies": {
"@iconify/svelte": "^3.1.4",
"@popperjs/core": "^2.11.8",
"@tanstack/svelte-query": "^4.36.1",
"@tanstack/svelte-query": "^5.26.3",
"ag-grid-community": "^30.2.0",
"ag-grid-svelte": "^0.3.0",
"chart.js": "^4.4.0",
Expand Down
16 changes: 8 additions & 8 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/lib/components/StatusButton.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<div
class="col-start-1 col-end-1 row-start-1 row-end-1 flex items-center justify-center"
>
{#if internalStatus === 'loading'}
{#if internalStatus === 'pending'}
<Spinner size="4" color="white" />
{:else if internalStatus === 'success'}
<Icon icon="bx:check" class="w-5 h-5" />
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/webhooks/WebhookResetSecretButton.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@
return webhookUpdate;
},
onSuccess() {
queryClient.invalidateQueries(['webhooks', id]);
queryClient.invalidateQueries({ queryKey: ['webhooks', id] });
}
});
</script>

{#if $resetSecretMutation.isLoading}
{#if $resetSecretMutation.isPending}
<Spinner size="6" />
{:else if $resetSecretMutation.isSuccess}
<Icon icon="bx:check-circle" class="w-6 h-6 text-green-500" />
Expand Down
11 changes: 7 additions & 4 deletions src/lib/stores/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ import { useService } from '$lib/services';

const aboutService = useService(AboutApi);

export const userStore = createQuery({
context: queryClient,
queryFn: () => aboutService.getCurrentUser()
});
export const userStore = createQuery(
{
queryKey: ['user'],
queryFn: () => aboutService.getCurrentUser()
},
queryClient
);
2 changes: 1 addition & 1 deletion src/routes/export/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
color={$exportTransactions.isSuccess ? 'green' : 'primary'}
on:click={() => $exportTransactions.mutate()}
>
{#if $exportTransactions.isLoading}
{#if $exportTransactions.isPending}
<Spinner size="6" />
{:else if $exportTransactions.isSuccess}
<Icon icon="bx-check" class="w-6 h-6" />
Expand Down

0 comments on commit 163ee07

Please sign in to comment.