[BUG] auth provider's check
method triggering unwanted refresh with XHR call
#6639
Labels
check
method triggering unwanted refresh with XHR call
#6639
Describe the bug
Hello Refine dev team,
I have a basic registration form that uses the
useRegister
hook'smutate
function to submit form values.The problem I'm facing is that when the registration is unsuccessful, the page gets refreshed and the browser is interpreting this as a sign to prompt the user to store/update the new password. This is not the expected behavior when the registration failed because of existing username, for example.
More details. I've tracked down the issue to the
invalidateAuthStore
function in theuseRegister
implementation, which is invalidating the "check" query. The refresh only happens if thecheck
implementation includes an awaited XHR (fetch).I understand the browser behavior is out of your control, but I wonder if the refresh mechanism is intentional? It certainly seems like a bug to me.
Steps To Reproduce
register
method which returns{ success: false, redirectTo: undefined }
check
method, add any plain fetch to a server. (The simplest is to start a simple HTTP server locally so that you don't run into CORS issues)Expected behavior
Ideally, the cache invalidation should happen silently and only trigger a refresh if needed. In the case described above, there's no reason to refresh/re-render anything.
Packages
Basic packages included by the
npm create refine-app@latest
command.v1.12.9
at time of writing.Additional Context
No response
The text was updated successfully, but these errors were encountered: