Skip to content

Conversation

@phoenix-ru
Copy link
Collaborator

@phoenix-ru phoenix-ru commented Sep 19, 2025

πŸ”— Linked issue

Closes #1042, closes #1052

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

This fixes the global middleware recursion when signIn is called and its result is passed to vue-router directly.

Important context:

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have added tests (if possible).
  • I have updated the documentation accordingly.
@pkg-pr-new
Copy link

pkg-pr-new bot commented Sep 19, 2025

Open in StackBlitz

npm i https://pkg.pr.new/@sidebase/nuxt-auth@1057 

commit: c806709

Copy link
Contributor

@BracketJohn BracketJohn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very interesting indeed! Do you know when/how this was introduced? Because for a long time this was not an error, right?

Very good find + investigation, props! ❀️

status: number
ok: boolean
url: any
navigationResult: boolean | string | void | undefined
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a. Any chance we can make this type more speaking? eg making this a string-union with speaking members for different known results?
b. can/should we document this somewhere? either inside the docs or as a docstring in-code that explains the different variants and what this key means?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a. Not really, as this is a value returned by either navigateToAuthPageWN or vue-router. I would prefer to modify this value as little as possible, since we need to immediately pass it back to vue-router.

b. I can add a doctext explaining what this value is

@phoenix-ru
Copy link
Collaborator Author

phoenix-ru commented Sep 19, 2025

Do you know when/how this was introduced? Because for a long time this was not an error, right?

d98cef8

Comment on lines +64 to +65
// router.afterEach(final => final.fullPath === location ? redirect(false) : undefined)
// return href
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this code leftover/dead? it doesnt seem to belong to the comment above?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this code was commented exactly due to the explanation above

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didnt get that, a colon would be helpful! But alas: definitely a nit, wont block the merge for this (:

Copy link
Collaborator Author

@phoenix-ru phoenix-ru Sep 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI: The problem is also present in Nuxt's navigateTo, I am publishing a reproduction

Their implementation gets the same problem:

Redirect was called { fullPath: '/redirect?callback=%2Fother', 'final.fullPath': '/redirect?callback=/other', 'final.fullPath === fullPath': false } 
Copy link
Collaborator Author

@phoenix-ru phoenix-ru Sep 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reproduction repo: https://github.com/phoenix-ru/nuxt-navigate-to-fullpath-reproduction

Issue will be created shortly

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please link it here as well!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issue created: nuxt/nuxt#33273

@phoenix-ru phoenix-ru merged commit 5bb5478 into main Sep 23, 2025
7 checks passed
@phoenix-ru phoenix-ru deleted the fix/1042-1052-middleware-hang branch September 23, 2025 07:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants