Skip to content
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

docs: add warning about redirect check #20680

Merged

Conversation

GalacticHypernova
Copy link
Contributor

@GalacticHypernova GalacticHypernova commented May 4, 2023

πŸ”— Linked issue

Fixes #20678

❓ 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 PR fixes multiple issues with the newly merged docs, such as to.path usage in route guards (in stead of from.path, because we don't want to force people onto a specific route, the goal is to avoid infinite redirects). Also, this fixes an undefined variable 'user' in the "err as a String" section of the api/utils/abort-navigation page.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@codesandbox
Copy link

codesandbox bot commented May 4, 2023

CodeSandbox logoCodeSandbox logoΒ  Open in CodeSandbox Web Editor | VS Code | VS Code Insiders

@nuxt-studio
Copy link

nuxt-studio bot commented May 4, 2023

βœ… Live Preview ready!

Name Edit Preview Latest Commit
Nuxt Docs Edit on Studio β†—οΈŽ View Live Preview ed1dbe2

@GalacticHypernova GalacticHypernova changed the title docs: Fix 20678 docs/middleware redirects docs: Fix #20678 docs May 4, 2023
@GalacticHypernova
Copy link
Contributor Author

Oops, didn't know what re-requesting review button would do

Copy link
Member

@danielroe danielroe left a comment

Choose a reason for hiding this comment

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

Let's keep the current to.path rather than from.path but we can add a comment along the lines of:

// in a real app you would probably not redirect every route to `/`
// but it is important to check `to.path` before redirecting or you
// may cause an infinite redirect loop

@GalacticHypernova
Copy link
Contributor Author

Sure thing!

Copy link
Member

@danielroe danielroe left a comment

Choose a reason for hiding this comment

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

Thanks!

@danielroe danielroe changed the title docs: Fix #20678 docs docs: add warning about redirect check Jun 12, 2023
@danielroe danielroe merged commit 4ac4dfd into nuxt:main Jun 12, 2023
2 checks passed
@github-actions github-actions bot mentioned this pull request Jun 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants