forked from vercel/next.js
-
Notifications
You must be signed in to change notification settings - Fork 0
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
[pull] canary from vercel:canary #106
Open
pull
wants to merge
5,100
commits into
ekpyrosis:canary
Choose a base branch
from
vercel:canary
base: canary
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## 📚 Improving Documentation Hello, I’ve updated the `02-jest.mdx` documentation with the following improvements: 1. I added the comment, `"The content of this doc is shared between the app and pages router."` This document is used by both the Pages Router and App Router, and I found this comment in other files within the `docs` directory. 2. ~~I introduced `<PagesOnly>` and `<AppOnly>` components. Previously, when clicking links in the App Router page, it would navigate to the Pages Router documentation. I’ve modified this so that links open in the App Router documentation when viewed there.~~ 3. Additional typo corrections: 1. Removed colons (`:`) from headings, as they aren’t used in other docs. 2. Added missing double quotes (`"`). --------- Co-authored-by: JJ Kasper <jj@jjsweb.site>
current [link](https://workos.com/docs/user-management) for WorkOS point to Node.js document, This update ensures all links lead directly to their respective Next.js integration pages. Also updated link for Stytch and Kinde auth link to point to appropriate docs page. Co-authored-by: JJ Kasper <jj@jjsweb.site>
For a given path expression, we want it to optionally match a `.json` suffix. However, the original implementation was flawed: The path `/:id` was altered to `/:id(.json)?`, which then converted to the Regex pattern `^(?:\/(.json))?[\/#\?]?$`. This Regex incorrectly matched only `/` or `/_json` — clearly not the intended result. The fix involved adjusting the way we append the `.json` suffix. Instead of `/:id(.json)?`, we now use `/:id{(\\.json)}?`, which converts to the Regex `^(?:\/([^\/#\?]+?))(\.json)?[\/#\?]?$`. This pattern correctly matches both cases, with or without the `.json` suffix. ----- Fixes #53840 Fixes #55558 Closes DX-2088
## 📚 Fixed typos Hello, I've fixed redundant double space in `middleware-plugin.ts`. I think it is a typo. Co-authored-by: JJ Kasper <jj@jjsweb.site>
### What? This PR updates the Edge Runtime documentation to clarify the use of capitalization and improves formatting consistency. ### Why? To maintain documentation clarity and consistency, ensuring accurate information and readability across the documentation. --------- Co-authored-by: JJ Kasper <jj@jjsweb.site>
The "Examples" heading was not being rendered correctly [on this docs page](https://nextjs.org/docs/app/api-reference/file-conventions/page#displaying-content-based-on-params). All this does is fix the whitespace character to allow the MDX to be rendered properly. Co-authored-by: JJ Kasper <jj@jjsweb.site>
This isn't currently passing as the Turbopack Build handling is missing - we'll fix forward. Skipping temporarily to unblock CI. (GitHub actions had an incident when #72056 ran CI so this was not caught by checks)
After adding validation that fixing invalid segment configs (when DIO is enabled), it revealed that errors weren't being displayed in Turbopack, because `setHMRServerError` wasn't implemented. This refactors the implementation to use the existing server component transform when validating if the segments are valid. This has the benefit of highlighting precisely where the segment is coming, making it easier to remove. The test that was skipped in Turbopack is also re-enabled. <details> <summary>Screenshot</summary> ![CleanShot 2024-10-29 at 17 03 46@2x](https://github.com/user-attachments/assets/a68c060a-6ae7-4c6c-8243-6c48c2703f66) </details>
…erty name (#72083) The `treeshaking` property in the turbo config docs wasn't using camel case like the property it represents. So to be inline with the property names I changed to the correct name/casing. Co-authored-by: JJ Kasper <jj@jjsweb.site>
### What? Nextjs 15 changed generateMetadata params type. It will cause build error when follow the docs. Co-authored-by: JJ Kasper <jj@jjsweb.site>
The `cookieStore` was initialized from `cookies()` So when calling methods use `cookieStore.get` instead of `cookieStore().get`. Applies for all other methods --------- Co-authored-by: JJ Kasper <jj@jjsweb.site>
Small docs import statement fix Co-authored-by: JJ Kasper <jj@jjsweb.site>
<!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change(s) that you're making: ## For Contributors ### Improving Documentation - Run `pnpm prettier-fix` to fix formatting issues before opening the PR. - Read the Docs Contribution Guide to ensure your contribution follows the docs guidelines: https://nextjs.org/docs/community/contribution-guide ### Adding or Updating Examples - The "examples guidelines" are followed from our contributing doc https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md - Make sure the linting passes by running `pnpm build && pnpm lint`. See https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md ### Fixing a bug - Related issues linked using `fixes #number` - Tests added. See: https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ### Adding a feature - Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. (A discussion must be opened, see https://github.com/vercel/next.js/discussions/new?category=ideas) - Related issues/discussions are linked using `fixes #number` - e2e tests added (https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) - Documentation added - Telemetry added. In case of a feature if it's used or not. - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ## For Maintainers - Minimal description (aim for explaining to someone not on the team to understand the PR) - When linking to a Slack thread, you might want to share details of the conclusion - Link both the Linear (Fixes NEXT-xxx) and the GitHub issues - Add review comments if necessary to explain to the reviewer the logic behind a change ### What? ### Why? ### How? Closes NEXT- Fixes # --> The fix in #70680 is still misleading. `missingSuspenseWithCSRBailout` is valid in `14` and invalid in `Above 14`. Co-authored-by: JJ Kasper <jj@jjsweb.site>
<!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change(s) that you're making: ## For Contributors ### Improving Documentation - Run `pnpm prettier-fix` to fix formatting issues before opening the PR. - Read the Docs Contribution Guide to ensure your contribution follows the docs guidelines: https://nextjs.org/docs/community/contribution-guide ### Adding or Updating Examples - The "examples guidelines" are followed from our contributing doc https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md - Make sure the linting passes by running `pnpm build && pnpm lint`. See https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md ### Fixing a bug - Related issues linked using `fixes #number` - Tests added. See: https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ### Adding a feature - Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. (A discussion must be opened, see https://github.com/vercel/next.js/discussions/new?category=ideas) - Related issues/discussions are linked using `fixes #number` - e2e tests added (https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) - Documentation added - Telemetry added. In case of a feature if it's used or not. - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ## For Maintainers - Minimal description (aim for explaining to someone not on the team to understand the PR) - When linking to a Slack thread, you might want to share details of the conclusion - Link both the Linear (Fixes NEXT-xxx) and the GitHub issues - Add review comments if necessary to explain to the reviewer the logic behind a change ### What? ### Why? ### How? Closes NEXT- Fixes # --> Co-authored-by: JJ Kasper <jj@jjsweb.site>
The typescript switcher show a .js extension. changed to tsx. Co-authored-by: JJ Kasper <jj@jjsweb.site>
The searchParams type must be wrapped in a `Promise` within synchronous components/pages to ensure they can be safely passed to React's `use()` hook <!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change(s) that you're making: ## For Contributors ### Improving Documentation - Run `pnpm prettier-fix` to fix formatting issues before opening the PR. - Read the Docs Contribution Guide to ensure your contribution follows the docs guidelines: https://nextjs.org/docs/community/contribution-guide ### Adding or Updating Examples - The "examples guidelines" are followed from our contributing doc https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md - Make sure the linting passes by running `pnpm build && pnpm lint`. See https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md ### Fixing a bug - Related issues linked using `fixes #number` - Tests added. See: https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ### Adding a feature - Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. (A discussion must be opened, see https://github.com/vercel/next.js/discussions/new?category=ideas) - Related issues/discussions are linked using `fixes #number` - e2e tests added (https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) - Documentation added - Telemetry added. In case of a feature if it's used or not. - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ## For Maintainers - Minimal description (aim for explaining to someone not on the team to understand the PR) - When linking to a Slack thread, you might want to share details of the conclusion - Link both the Linear (Fixes NEXT-xxx) and the GitHub issues - Add review comments if necessary to explain to the reviewer the logic behind a change ### What? ### Why? ### How? Closes NEXT- Fixes # --> Co-authored-by: JJ Kasper <jj@jjsweb.site>
<!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change(s) that you're making: ## For Contributors ### Improving Documentation - Run `pnpm prettier-fix` to fix formatting issues before opening the PR. - Read the Docs Contribution Guide to ensure your contribution follows the docs guidelines: https://nextjs.org/docs/community/contribution-guide ### Adding or Updating Examples - The "examples guidelines" are followed from our contributing doc https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md - Make sure the linting passes by running `pnpm build && pnpm lint`. See https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md ### Fixing a bug - Related issues linked using `fixes #number` - Tests added. See: https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ### Adding a feature - Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. (A discussion must be opened, see https://github.com/vercel/next.js/discussions/new?category=ideas) - Related issues/discussions are linked using `fixes #number` - e2e tests added (https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) - Documentation added - Telemetry added. In case of a feature if it's used or not. - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ## For Maintainers - Minimal description (aim for explaining to someone not on the team to understand the PR) - When linking to a Slack thread, you might want to share details of the conclusion - Link both the Linear (Fixes NEXT-xxx) and the GitHub issues - Add review comments if necessary to explain to the reviewer the logic behind a change ### What? Add unstable version to `unstable_after` ### Why? This lets users reading the documentation see the experimental/unstable icon and tooltip when viewing the documentation ### How? Closes NEXT- Fixes # --> Co-authored-by: JJ Kasper <jj@jjsweb.site>
Ory: https://www.ory.sh/docs/getting-started/integrate-auth/nextjs Ory GitHub: https://github.com/ory --------- Co-authored-by: JJ Kasper <jj@jjsweb.site>
Correct typo from 'errror' to 'error'. Co-authored-by: JJ Kasper <jj@jjsweb.site>
### Why? - Next.js uses [AsyncLocalStorage.snapshot](https://github.com/vercel/next.js/blob/c32e2802097c03fd9f95b1dae228d6e0257569c0/packages/next/src/server/app-render/async-local-storage.ts#L60) function. - `AsyncLocalStorage.snapshot` [was added in](https://nodejs.org/api/async_context.html#static-method-asynclocalstoragesnapshot) Node.js `19.8.0`, `18.16.0`. - However, the supported Node.js version range was `>= 18.18.0`. - Which allowed Node.js `< 19.8.0` to be used, and causing an error: ![image](https://github.com/user-attachments/assets/c76b9ce2-c9e1-46c6-a472-d5268de76ff9) > Image Source: https://x.com/smakosh/status/1851565997804667253 ### How? Modified the version range as `"^18.18.0 || ^19.8.0 || >= 20.0.0"`. Confirmed that >= 20 are fully compatible so far. ### Things to Consider Should we limit the upper to prevent deprecated/breaking changes? If so, what would be the suitable upper-limit version?
Context - I only fixed webpack codepath for #72056 - But we ended up merging it despite the fact the CI would fail due to Github incident https://www.githubstatus.com/incidents/9yk1fbk0qjjc Notes - `middleware.rs` only runs in build time for production turbopack build - without this fix, the test would fail on 404 for prod mode, but would land on Chat page for dev mode
## 📚 Fixed typos Hello, I've fixed redundant double spaces in `test/.stats-app/app`. Co-authored-by: JJ Kasper <jj@jjsweb.site>
…config. (#72042) As it is currently with a literal type, this type isn't very useful. As https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-inference explains, TypeScript infers these types on middleware configs as strings, so middleware configs aren't inferred as this type. This can be fixed by adding `as const` after the string literal, but that is annoying to do everywhere (it also isn't currently supported by Next.js: https://github.com/vercel/next.js/blob/89ee26cc76de11c7110dda17389fcfa50c9dbe36/packages/next/src/build/analysis/extract-const-value.ts#L103). By removing this type restriction, this type will be more useful. This is safe to do because this type isn't currently being used anywhere (it never matches) and Next.js already carefully checks/verifies the type of this middleware config object at build time, so will still find any issues then. Co-authored-by: JJ Kasper <jj@jjsweb.site>
<!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change(s) that you're making: ## For Contributors ### Improving Documentation - Run `pnpm prettier-fix` to fix formatting issues before opening the PR. - Read the Docs Contribution Guide to ensure your contribution follows the docs guidelines: https://nextjs.org/docs/community/contribution-guide ### Adding or Updating Examples - The "examples guidelines" are followed from our contributing doc https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md - Make sure the linting passes by running `pnpm build && pnpm lint`. See https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md ### Fixing a bug - Related issues linked using `fixes #number` - Tests added. See: https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ### Adding a feature - Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. (A discussion must be opened, see https://github.com/vercel/next.js/discussions/new?category=ideas) - Related issues/discussions are linked using `fixes #number` - e2e tests added (https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) - Documentation added - Telemetry added. In case of a feature if it's used or not. - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ## For Maintainers - Minimal description (aim for explaining to someone not on the team to understand the PR) - When linking to a Slack thread, you might want to share details of the conclusion - Link both the Linear (Fixes NEXT-xxx) and the GitHub issues - Add review comments if necessary to explain to the reviewer the logic behind a change ### What? ### Why? ### How? Closes NEXT- Fixes # --> ### What? Currently, the `router.push` method does not sanitize URL arguments, which can cause cross-site scripting (XSS) bugs in next.js sites through the running of untrusted code in a JavaScript URL. This was reported as #50093 and was closed, with an explanation that it is the developer's responsibility to sanitize `router.push` input. This PR is an addition to the next.js docs to document that issue and let developers know that they cannot send untrusted or unsanitized URLs into `router.push`. ### Why? Cross-site scripting bugs can be quite high severity, as they often allow attackers to steal credentials and data. Furthermore, the API most similar to `router.push` in the web API, `history.pushState`, does not accept JavaScript URLs, so developers might reasonably not know that they need to sanitize `router.push` input. Searching through public github repos finds more than 1,000 projects that may be vulnerable to this issue, so I believe it's a pretty widespread misunderstanding of the API.
<!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change(s) that you're making: ## For Contributors ### Improving Documentation - Run `pnpm prettier-fix` to fix formatting issues before opening the PR. - Read the Docs Contribution Guide to ensure your contribution follows the docs guidelines: https://nextjs.org/docs/community/contribution-guide ### Adding or Updating Examples - The "examples guidelines" are followed from our contributing doc https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md - Make sure the linting passes by running `pnpm build && pnpm lint`. See https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md ### Fixing a bug - Related issues linked using `fixes #number` - Tests added. See: https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ### Adding a feature - Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. (A discussion must be opened, see https://github.com/vercel/next.js/discussions/new?category=ideas) - Related issues/discussions are linked using `fixes #number` - e2e tests added (https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) - Documentation added - Telemetry added. In case of a feature if it's used or not. - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ## For Maintainers - Minimal description (aim for explaining to someone not on the team to understand the PR) - When linking to a Slack thread, you might want to share details of the conclusion - Link both the Linear (Fixes NEXT-xxx) and the GitHub issues - Add review comments if necessary to explain to the reviewer the logic behind a change Closes NEXT- Fixes # --> ### What? Explicitly mentions `--inspect=0.0.0.0` and its use case. ### Why? NextJS apps are commonly run inside docker containers when self-hosting. In this case, the example in the docs will not work as expected, blocking users who are not familiar with the --inspect flag. ### How? Added a "Good to Know" content block. Co-authored-by: JJ Kasper <jj@jjsweb.site>
This PR updates the server actions error handling section to remove advising using a try catch, in favor of linking to the Error Handling docs, which has the correct information. <!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change(s) that you're making: ## For Contributors ### Improving Documentation - Run `pnpm prettier-fix` to fix formatting issues before opening the PR. - Read the Docs Contribution Guide to ensure your contribution follows the docs guidelines: https://nextjs.org/docs/community/contribution-guide ### Adding or Updating Examples - The "examples guidelines" are followed from our contributing doc https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md - Make sure the linting passes by running `pnpm build && pnpm lint`. See https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md ### Fixing a bug - Related issues linked using `fixes #number` - Tests added. See: https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ### Adding a feature - Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. (A discussion must be opened, see https://github.com/vercel/next.js/discussions/new?category=ideas) - Related issues/discussions are linked using `fixes #number` - e2e tests added (https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) - Documentation added - Telemetry added. In case of a feature if it's used or not. - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ## For Maintainers - Minimal description (aim for explaining to someone not on the team to understand the PR) - When linking to a Slack thread, you might want to share details of the conclusion - Link both the Linear (Fixes NEXT-xxx) and the GitHub issues - Add review comments if necessary to explain to the reviewer the logic behind a change ### What? ### Why? ### How? Closes NEXT- Fixes # -->
### What? * add load speed and total time * reuse buffer while loading * performance with parallelisation * allow to disable corrected time for performance reasons * parallelize graph creation
…adings in TS and ESLint config pages (#72465) This PR: - Moves `next.config.js` options under a "config" folder which includes references for other configuration such as the ESLint plugin. I figure it would be tidier than having "Next.config.js Options" and "Config" in the API reference. - Fixes the issue with the "config" folder not showing up in canary: https://linear.app/vercel/issue/DOC-3749/bug-figure-out-why-new-config-folder-isnt-showing-up-in-the-canary - Fixes the indentation issues and missing example header (caused by an invisible character). Redirects: vercel/front#38704
### What? Adds a TODO for a low hanging performance fruit
## Description Follow up #72391. I missed some error pages. ### Improving Documentation - [x] Run `pnpm prettier-fix` to fix formatting issues before opening the PR. - [x] Read the Docs Contribution Guide to ensure your contribution follows the docs guidelines: https://nextjs.org/docs/community/contribution-guide Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
Hi, Team. I'd like to contribute as removing unnecessary fragments. I believe that the fragment will create one more grouping node on virtual dom, which is not necessary on this example. If it is essential, please kindly let me know why. Thank you so much for your support. ### Improving Documentation - remove unnecessary fragment tags Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
…d-mutations.mdx (#72496) #### Description: - fix grammatical error: remove unnecessary 'a' Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
This PR fixes a broken link. In my language (Japanese), MDN redirects were not functioning correctly, so I replaced them with appropriate links. https://developer.mozilla.org/docs/Web/Events/popstate redirects https://developer.mozilla.org/ja/docs/Web/Events/popstate (404) Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
## Description [create-playwright](https://github.com/microsoft/create-playwright) makes the below special `.gitignore` file. ```txt node_modules/ /test-results/ /playwright-report/ /blob-report/ /playwright/.cache/ ``` It's good to add these files to .gitignore for convinience. ### Adding or Updating Examples - [x] The "examples guidelines" are followed from our contributing doc https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md - [x] Make sure the linting passes by running `pnpm build && pnpm lint`. See https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md Co-authored-by: JJ Kasper <jj@jjsweb.site>
…l!()` (#72487) Early returns should use `anyhow::bail!()`. Ran ast-grep with ```bash sg run --lang rust --pattern 'return Err(anyhow!($$$ARGS));' --rewrite 'anyhow::bail!($$$ARGS)' --update-all && sg run --lang rust --pattern 'return Err(anyhow::anyhow!($$$ARGS));' --rewrite 'anyhow::bail!($$$ARGS)' --update-all && cargo fmt ``` Manually cleaned up unused import warnings (second commit) because `cargo fix` hangs (idle, no CPU usage) about halfway through our build, and I'm not sure why. I tested the latest nightly, and it hangs too.
The path to the export from the `dist` directory currently doesn't resolve.
...and use test patterns more consistently
Bumps `edge-runtime` (and friends to not duplicate dependencies further) to include vercel/edge-runtime#1023
This pull request includes several changes to improve cache control handling and add new test cases for verifying cache headers in the standalone mode of the application. Improvements to cache control handling: * [`packages/next/src/server/base-server.ts`](diffhunk://#diff-6f4291cc2bfc5073fdca12a014011769e840ee68583db1468acef075f037015aL3295-R3298): Updated cache control conditions to check for `undefined` explicitly before setting cache headers. [[1]](diffhunk://#diff-6f4291cc2bfc5073fdca12a014011769e840ee68583db1468acef075f037015aL3295-R3298) [[2]](diffhunk://#diff-6f4291cc2bfc5073fdca12a014011769e840ee68583db1468acef075f037015aL3318-R3324) [[3]](diffhunk://#diff-6f4291cc2bfc5073fdca12a014011769e840ee68583db1468acef075f037015aR3354-R3365) New test cases: * [`test/production/standalone-mode/required-server-files/required-server-files-app.test.ts`](diffhunk://#diff-0d083b6c7bd3a8a3e9c5ee854123ada3b72db58220d8b65912b047b082f834a2R104-R129): Added test cases to verify that the correct cache headers are sent for app routes and app pages. New static and dynamic route handlers: * `test/production/standalone-mode/required-server-files/app/api/test/[slug]/route.js`: Added a new dynamic route handler with forced static generation. ([test/production/standalone-mode/required-server-files/app/api/test/[slug]/route.jsR1-R7](diffhunk://#diff-1cf8a2cfdbb6473656b2456af0267556270fbbaa7ee2c37e2f3e6c6fed1e4d21R1-R7)) * `test/production/standalone-mode/required-server-files/app/test/[slug]/page.jsx`: Added a new static page with a revalidation interval and a function to generate static parameters. ([test/production/standalone-mode/required-server-files/app/test/[slug]/page.jsxR1-R9](diffhunk://#diff-32038443ca3e4f28db37a6543966397682c64cf6f34e6dd03fd8096414d23022R1-R9)) - Fixes #65814 Co-authored-by: Janka Uryga <lolzatu2@gmail.com> Co-authored-by: Sam Ko <sam@vercel.com>
) ### What? Make the graph acyclic while condensation graphs so that the self-references do not exist. We are using `condensation` from `petgraph` and it has `make_acyclic: bool` option. I enabled it to make tree shaking a bit faster. ### Why? Self-reference in the module graph means slower build and needless runtime operations. ### How? Closes PACK-3439
Closes PACK-3318 Closes #71618 This is a good idea in general, and also works around a Tailwind bug breaking `next/font`: tailwindlabs/tailwindcss#14951
This adds `expireTag()` and `expirePath` APIs which are replacing `revalidateTag` and `revalidatePath`. As such this also marks `revalidatePath` and `revalidateTag` as deprecated and marked for removal. The arguments passed to these methods match `revalidateTag` and `revalidatePath` with the exception that `expireTag` can receive multiple tags now as separate arguments which matches our new `unstable_cacheTag()` API. We are wanting to update these APIs as `revalidateTag` naming has caused some confusion as to when the affected items will be updated. The underlying behavior of `expireTag` is to mark an entry as out of date and for it to no longer be used so we are expiring it. If you call `expirePath('/blog/first'`) the next time that item is requested it is considered expired so the cache will not be used for it and a fresh entry will be generated. Similarly for `expireTag('posts', 'blog')` the next time any cache with that tag is requested it's respective cache will not be leveraged and new cache will be populated. --------- Co-authored-by: Zack Tanner <1939140+ztanner@users.noreply.github.com> Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
… useEffect (#72362) ### What? Under certain circumstances, the Storage APIs, such as local storage, are not available. For example, the Brave browser allows users to block `all cookies`, which forbids access to local storage. - https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage#securityerror ### Why? When access to local storage fails, the development mode page crashes, leading to the `Application Error` view. ### How? Wrap on a try/catch the local storage access done within a use-effect, under `__NEXT_APP_ISR_INDICATOR`. There is another local storage access point, but that one is done as part of `processMessage`, which is called within a `try/catch` block already. Fixes #72046 Co-authored-by: JJ Kasper <jj@jjsweb.site>
When performing RSC requests, if the incoming data has a different build ID than the client, we perform an MPA navigation/refresh to load the updated build and ensure that the client and server in sync. Currently we store the build ID in the router state, but becauase it's always in lockstep with the app instance, it's not actually stateful. We can store it in a global. The ID gets assigned as a side-effect during app initialization. It should never change after being set the first time. In practice, because setAppBuildId is called before hydration starts, it will always get assigned to the actual build ID before it's ever needed by a navigation. (If for some reasons it didn't, due to a bug or race condition, then on navigation the build comparision would fail and trigger an MPA navigation.) The logical flow of how the global is assigned is more convoluted than it should be because we currently decode the Flight stream inside the React render phase (via a hook), because that's required to propagate resource hints correctly. Conceptually it would make more sense to decode the stream before starting hydration and pass the decoded data to the root component as props; this would also allow us to block hydration until the id is set. But we'll need to address the hints problem first. As a follow up, we should probably do the same thing for the App Router reducer, which is already a global store in practice but is referenced and passed everywhere as if it were owned by the React tree.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by pull[bot]
Can you help keep this open source service alive? 💖 Please sponsor : )