Skip to content

Commit 91aaf75

Browse files
authored
fix(core): move invalidation in useRegister to be called on success (#6658) Resolves (#6639)
1 parent 84a9b3d commit 91aaf75

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

.changeset/green-goats-fail.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"@refinedev/core": patch
3+
---
4+
5+
Move invalidation in `useRegister` to be called only on success.
6+
7+
[Resolves #6639](https://github.com/refinedev/refine/issues/6639)

packages/core/src/hooks/auth/useRegister/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ export function useRegister<TVariables = {}>({
131131
if (successNotification) {
132132
open?.(buildSuccessNotification(successNotification));
133133
}
134+
135+
await invalidateAuthStore();
134136
}
135137

136138
if (error || !success) {
@@ -148,8 +150,6 @@ export function useRegister<TVariables = {}>({
148150
replace("/");
149151
}
150152
}
151-
152-
await invalidateAuthStore();
153153
},
154154
onError: (error: any) => {
155155
open?.(buildNotification(error));

0 commit comments

Comments
 (0)