Skip to content

Commit

Permalink
fix(core): move invalidation in useRegister to be called on success (#…
Browse files Browse the repository at this point in the history
…6658) Resolves (#6639)
  • Loading branch information
arndom authored Feb 17, 2025
1 parent 84a9b3d commit 91aaf75
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions .changeset/green-goats-fail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@refinedev/core": patch
---

Move invalidation in `useRegister` to be called only on success.

[Resolves #6639](https://github.com/refinedev/refine/issues/6639)
4 changes: 2 additions & 2 deletions packages/core/src/hooks/auth/useRegister/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ export function useRegister<TVariables = {}>({
if (successNotification) {
open?.(buildSuccessNotification(successNotification));
}

await invalidateAuthStore();
}

if (error || !success) {
Expand All @@ -148,8 +150,6 @@ export function useRegister<TVariables = {}>({
replace("/");
}
}

await invalidateAuthStore();
},
onError: (error: any) => {
open?.(buildNotification(error));
Expand Down

0 comments on commit 91aaf75

Please sign in to comment.