-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Client Side Page Transitions #781
Comments
Thanks for raising this and describing it in detail. Essentially "easier to get right" is the main reason for this - it reduces the amount of problems people run into and the amount of requests for help using it that get raised. A secondary reason is keeping the methods decoupled from Next.js to try to avoid being impacted by breaking changes in Next.js and to be framework agnostic, even to React; with longer term goals of being suitable as a solution for Nuxt.js and other frameworks (currently there are some dependencies request/response middleware in a few places, but those are easily refactorable). The As noted, it's less of an issue with It would be nice to improve the behaviour on I do agree that these methods should not forcibly redirect in this way, with no way to prevent that. The intention is to add the option to not perform a redirect from these methods - e.g. by passing |
Really great write up on the reasoning behind this, and it's interesting that you're considering expanding to other frameworks.
I think this would be a really great solution. In my current use case I'm only using the email authentication and I don't really need to redirect anyone, just displaying a little alert saying the email was sent would be sufficient, and make everything look way cleaner. |
Hi there! It looks like this issue hasn't had any activity for a while. It will be closed if no further activity occurs. If you think your issue is still relevant, feel free to comment on it to keep it open. (Read more at #912) Thanks! |
This has been fixed by adding a https://next-auth.js.org/getting-started/client#using-the-redirect-false-option https://next-auth.js.org/getting-started/client#using-the-redirect-false-option-1 |
Your question
Why is
next-auth
not using Next.js client page transitions?In Detail
next-auth currently implements page transition using
window.location= <newURL>
.It uses this technique on login and on logout. I understand that on first oauth redirect request this doesn't make a difference, but on all other cases (Logout, api base oauth, CredentialsAuth, etc) is really makes a difference.
Example
next-auth/src/client/index.js
Lines 230 to 255 in 8115a7c
Cons (full redirects)
Pros (full redirects)
Proposal
The login flow could be much more fluent, if we switch or allow the usage of next client page transitions using
next.router.push()
andnext.router.replace()
, because we don't need to reinitialise the entire app.Whats needs to be done to make next client transitions work
What are you trying to do
Improve the login flow.
Can I help
If the next-auth team would be interested in such a change I could work on this topic.
Feedback
Documentation refers to searching through online documentation, code comments and issue history. The example project refers to next-auth-example.
The text was updated successfully, but these errors were encountered: