rsnext/packages/next
Sophie Alpert 05cd5157e5
app router: Fix infinite redirect loop in MPA navigation (#49058)
Not 100% convinced that this is the correct fix but it's the best I can
think of.

Previously, we would sometimes call location.assign()/.replace()
hundreds of times (or more) as I described in
https://github.com/vercel/next.js/issues/48438 and
https://github.com/vercel/next.js/issues/48309#issuecomment-1512290958.
Sometimes this would just make things slow but the navigation would
eventually succeed; sometimes this would just hang the browser.

Now we trigger it only once (or—for a reason I don't quite
understand—twice in dev, as you can see in the test) and never commit
that render.

This also fixes the bug I mentioned in
https://github.com/vercel/next.js/issues/48438#issuecomment-1528649776
where usePathname() and useSearchParams() would return the page we are
navigating to (even if that's an external page wholly unrelated to our
site!).

Fixes #48309, fixes #48438.

link NEXT-1028

Co-authored-by: Jimmy Lai <laijimmy0@gmail.com>
2023-05-03 11:04:53 +02:00
..
compat
font Remove experimental fontLoaders option from next.config.js (#46886) 2023-03-13 21:34:43 +00:00
image-types
legacy
navigation-types/compat Return null for useParams in pages (#47490) 2023-03-25 10:05:44 +01:00
src app router: Fix infinite redirect loop in MPA navigation (#49058) 2023-05-03 11:04:53 +02:00
types chore: rename draft mode enabled to isEnabled (#49096) 2023-05-02 21:45:28 +02:00
amp.d.ts
amp.js
app.d.ts
app.js
babel.d.ts
babel.js
cache.d.ts Update revalidate handling for app (#49062) 2023-05-02 08:19:02 -07:00
cache.js Update revalidate handling for app (#49062) 2023-05-02 08:19:02 -07:00
client.d.ts
client.js
config.d.ts
config.js
constants.d.ts
constants.js
document.d.ts
document.js
dynamic.d.ts
dynamic.js
error.d.ts
error.js
head.d.ts
head.js
headers.d.ts
headers.js
image.d.ts
image.js
index.d.ts Update revalidate handling for app (#49062) 2023-05-02 08:19:02 -07:00
jest.d.ts
jest.js
license.md Update license year (#44403) 2023-01-01 11:12:49 +01:00
link.d.ts
link.js
navigation.d.ts
navigation.js
package.json v13.3.5-canary.5 2023-05-03 06:00:23 +00:00
README.md
router.d.ts
router.js
script.d.ts
script.js
server.d.ts Update revalidate handling for app (#49062) 2023-05-02 08:19:02 -07:00
server.js Update revalidate handling for app (#49062) 2023-05-02 08:19:02 -07:00
taskfile-ncc.js Move core files to src folder and move JS files to TypeScript (#44405) 2023-01-03 10:05:50 +01:00
taskfile-swc.js feat: make enableUndici: true default and remove node-fetch (#49061) 2023-05-02 04:10:59 +00:00
taskfile-watch.js Replace taskr.watch for core compilation (#44027) 2022-12-14 16:06:53 +01:00
taskfile.js Add flag to switch to the experimental channel (#48896) 2023-05-01 15:49:10 +02:00
tsconfig.json next/navigation Typescript support for pages/ (#45919) 2023-02-14 17:26:01 -08:00
web-vitals.d.ts add useReportWebVitals that makes use of web-vitals package (#47319) 2023-03-24 10:13:50 +00:00
web-vitals.js add useReportWebVitals that makes use of web-vitals package (#47319) 2023-03-24 10:13:50 +00:00

Next.js

Getting Started

Visit https://nextjs.org/learn to get started with Next.js.

Documentation

Visit https://nextjs.org/docs to view the full documentation.

Who is using Next.js?

Next.js is used by the world's leading companies. Check out the Next.js Showcase to learn more.

Community

The Next.js community can be found on GitHub Discussions, where you can ask questions, voice ideas, and share your projects.

To chat with other community members you can join the Next.js Discord.

Our Code of Conduct applies to all Next.js community channels.

Contributing

Please see our contributing.md.

Good First Issues

We have a list of good first issues that contain bugs that have a relatively limited scope. This is a great place to get started, gain experience, and get familiar with our contribution process.

Authors

Security

If you believe you have found a security vulnerability in Next.js, we encourage you to responsibly disclose this and not open a public issue. We will investigate all legitimate reports. Email security@vercel.com to disclose any security vulnerabilities.

https://vercel.com/security