- 08 Sep, 2022 15 commits
-
-
JJ Kasper authored
-
JJ Kasper authored
-
Leon Si authored
<!-- Thanks for opening a PR! Your contribution is much appreciated. In order 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 that you're making: --> ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have helpful link attached, see `contributing.md` ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have helpful link attached, see `contributing.md` ## Documentation / Examples - [ ] Make sure the linting passes by running `pnpm lint` - [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
-
JJ Kasper authored
This removes the warning for `swcMinify` as a release candidate as it is now being marked as stable. x-ref: [slack thread](https://vercel.slack.com/archives/CGU8HUTUH/p1662647498560729) ## Documentation / Examples - [ ] Make sure the linting passes by running `pnpm lint` - [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
-
Carl von Buelow authored
* fixes #18398 * fixes #38864 Co-authored-by:Steven <steven@ceriously.com>
-
Balázs Orbán authored
~(PR https://github.com/jsx-eslint/eslint-plugin-react/pull/3377) introduced a change in `eslint-plugin-react@7.31.2` that will now show an error when unknown properties appear on elements. We can opt out of this by overriding the default.~ As discussed internally, we are turning `react/no-unknown-property` off, as it might be confusing even if different props are being used, (eg.: `css` for `emotion`). It's easy to fix https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unknown-property.md#rule-options, but it might not be clear at first glance that Next.js is using `eslint-plugin-react` internally. If the user wants to enforce this rule, they can still add it to their own `rules` config. Fixes #40321, ref: https://github.com/vercel/next.js/discussions/40269, https://github.com/vercel/next.js/issues/38333
-
Steven authored
This updates the docs to favor `remotePatterns` image config (instead of `domains`)
-
Steven authored
-
Henrik Wenz authored
## Changes see commits ## Context As discussed in https://github.com/vercel/next.js/pull/40302#issuecomment-1239238966 we are going to merge the mobx examples. #40302 ## Documentation / Examples - [x] Make sure the linting passes by running `pnpm lint` - [x] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
-
Henrik Wenz authored
## Documentation / Examples - [x] Make sure the linting passes by running `pnpm lint` - [x] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
-
S0UPernova authored
## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have helpful link attached, see `contributing.md` ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have helpful link attached, see `contributing.md` ## Documentation / Examples - [ ] Make sure the linting passes by running `pnpm lint` - [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
-
Balázs Orbán authored
Closes #40336
-
Gal Schlezinger authored
Given the change in #40076, when a middleware rewrites into an Edge API route and changes the querystring, the changed querystring does not appear in the incoming NextRequest object in the Edge API route ```ts // middleware.ts export function middleware(req: NextRequest) { const url = req.nextUrl; url.pathname = "/api/hello"; url.searchParams.set("foo", "bar"); return NextResponse.rewrite(url); } // pages/api/hello.ts import { NextRequest } from "next/server"; export default function handler(req: NextRequest) { return NextResponse.json(req.nextUrl.searchParams.get("foo")); } export const config = { runtime: "experimental-edge" }; ``` Our expectation when requesting `/api/hello` is to see `"bar"`, but instead we are getting `null` back. This commit fixes this issue by reading the given `query` instead of using the initial querystring provided with the user request (prior to rewriting) ## Bug - [x] Related issues linked using `fixes #number` - [x] Integration tests added - [ ] Errors have helpful link attached, see `contributing.md` -
JH.Lee authored
This PR removes `in_function_params` field in `RemoveConsole` module. It's an unnecessary field that does not affect the module.
-
JJ Kasper authored
-
- 07 Sep, 2022 14 commits
-
-
Henrik Wenz authored
## Documentation / Examples - [x] Make sure the linting passes by running `pnpm lint` - [x] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
-
William Duplenne authored
Hi
👋 Based on https://nextjs.org/docs/advanced-features/compiler#remove-react-properties, this is not experimental but lives under `compiler` now. ## Documentation / Examples - [x] Make sure the linting passes by running pnpm lint - [x] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples) -
Henrik Wenz authored
## Documentation / Examples - [x] Make sure the linting passes by running `pnpm lint` - [x] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
-
JJ Kasper authored
This unreverts https://github.com/vercel/next.js/pull/40328 as it wasn't the cause for https://github.com/vercel/next.js/issues/40241 like initially suspected and the actual fix has been included here as well with regression test. Fixes: https://github.com/vercel/next.js/issues/40241 ## Bug - [x] Related issues linked using `fixes #number` - [x] Integration tests added - [ ] Errors have helpful link attached, see `contributing.md`
-
JJ Kasper authored
-
Hannes Bornö authored
Makes it possible to switch between edge/server runtime in dev without breaking the server. Fixes slack: [1](https://vercel.slack.com/archives/CGU8HUTUH/p1659082535540549) [2](https://vercel.slack.com/archives/C02CDC2ALJH/p1658978287244359) [3](https://vercel.slack.com/archives/C03KAR5DCKC/p1656869427468779) #### middleware-plugin.ts `middlewareManifest` moved from module scope to local scope. Stale state from earlier builds ended up in `middleware-manifest.json`. Functions that changed from edge to server runtime stayed in the manifest as edge functions. #### on-demand-entry-handler.ts When a server or edge entry is added we check if it has switched runtime. If that's the case the old entry is removed. #### Reproduce Create edge API route and visit `/api/hello` ```js // pages/api/hello.js export const config = { runtime: 'experimental-edge', } export default () => new Response('Hello') ``` Change it to a server api route and visit `/api/hello`, it will explode. ```js // pages/api/hello.js export default function (req, res) { res.send('Hello') } ``` #### Bug not fixed One EDGE case is not fixed. It occurs if you switch between edge and server runtime several times without changing the content of the file: Edge runtime ```js export const config = { runtime: 'experimental-edge', } export default () => new Response('Hello') ``` Change it to a server runtime ```js export default function (req, res) { res.send('Hello') } ``` Change back to edge runtime, the content of the file is the same as the first time we compiled the edge runtime version. ```js export const config = { runtime: 'experimental-edge', } export default () => new Response('Hello') ``` The reason is that both the edge and server compiler emits to the same file (/.next/server/pages/api/hello.js) which makes this check fail in webpack: https://github.com/webpack/webpack/blob/main/lib/Compiler.js#L849-L861 Possible solution is to use different output folders for edge and server https://vercel.slack.com/archives/CGU8HUTUH/p1661163106667559Co-authored-by:
JJ Kasper <jj@jjsweb.site>
-
JJ Kasper authored
This temporarily reverts the refactor while we investigate https://github.com/vercel/next.js/issues/40241 further. Reverts vercel/next.js#39902
-
Hannes Bornö authored
Currently the DEV server can't recover if you export an invalid runtime config. It ends up in a state where it stops to work but nothing is printed to the terminal. It now prints an error but keeps working. When building it should crash, there's an existing test for that https://github.com/vercel/next.js/blob/canary/test/production/exported-runtimes-value-validation/index.test.ts#L5-L17 #### Reproduce ```tsx export default function Page() { return <p>hello world</p> } export const config = { runtime: 'something-odd', } ```
-
Jiachi Liu authored
Fix the ssr/ssg detection when you export a nextjs data fetching method as a variable instead of an async function. - [x] Add case support in `checkExports` - [x] Add unit tests for `getPageStaticInfo`
-
Balázs Orbán authored
The issue validator GitHub action has been running in the background for a while, and the output looks good: https://github.com/vercel/next.js/actions/workflows/validate_issue.yml This PR switches off debug mode and will start commenting on improper bug reports to make triaging more effective.
-
Henrik Wenz authored
## Documentation / Examples - [x] Make sure the linting passes by running `pnpm lint` - [x] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
-
Ben Heidemann authored
<!-- Thanks for opening a PR! Your contribution is much appreciated. In order 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 that you're making: --> ## Bug - [X] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have helpful link attached, see `contributing.md` Fixes #36251
-
Henrik Wenz authored
## Changelog see commits ## Documentation / Examples - [x] Make sure the linting passes by running `pnpm lint` - [x] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
-
Balázs Orbán authored
## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have helpful link attached, see `contributing.md` ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have helpful link attached, see `contributing.md` ## Documentation / Examples - [ ] Make sure the linting passes by running `pnpm lint` - [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
-
- 06 Sep, 2022 9 commits
-
-
Alex Castle authored
This PR updates the next/image and `next/future/image` sizes docs to use `max-width` in the `sizes` media query, for code style and consistency reasons.
-
Alex Castle authored
This PR is a minor change to the image docs (`next/image` and `next/future/image`). The example sizes media queries are switched from `em` to `px` for readability.
-
JJ Kasper authored
This removes the optional chaining inside of the `executeAsync` as that is treated literally when passed to the browser and Safari 10.1 doesn't support optional chaining. fixes: https://github.com/vercel/next.js/runs/8213273664?check_suite_focus=true fixes: https://github.com/vercel/next.js/runs/8213237056?check_suite_focus=true
-
Steven authored
This PR allows you to resize a statically imported image using only `width` or only `height`. For example: ```jsx import img from './img.jpg' <Image src={img} width="200" /> ``` Previously, you had to specify both or else the image aspect ratio would not be preserved. -
Tim Neutkens authored
Follow-up to #37551 Implements prefetching for the new router. There are multiple behaviors related to prefetching so I've split them out for each case. The list below each case is what's prefetched: Reference: - Checkmark checked → it's implemented. - RSC Payload → Rendered server components. - Router state → Patch for the router history state. - Preloads for client component entry → This will be handled in a follow-up PR. - No `loading.js` static case → Will be handled in a follow-up PR. --- - `prefetch={true}` (default, same as current router, links in viewport are prefetched) - [x] Static all the way down the component tree - [x] RSC payload - [x] Router state - [ ] preloads for the client component entry - [x] Not static all the way down the component tree - [x] With `loading.js` - [x] RSC payload up until the loading below the common layout - [x] router state - [ ] preloads for the client component entry - [x] No `loading.js` (This case can be static files to make sure it’s fast) - [x] router state - [ ] preloads for the client component entry - `prefetch={false}` - [x] always do an optimistic navigation. We already have this implemented where it tries to figure out the router state based on the provided url. That result might be wrong but the router will automatically figure out that --- In the first implementation there is a distinction between `hard` and `soft` navigation. With the addition of prefetching you no longer have to add a `soft` prop to `next/link` in order to leverage the `soft` case. A heuristic has been added that automatically prefers `soft` navigation except when navigating between mismatching dynamic parameters. An example: - `app/[userOrTeam]/dashboard/page.js` and `app/[userOrTeam]/dashboard/settings/page.js` - `/tim/dashboard` → `/tim/dashboard/settings` = Soft navigation - `/tim/dashboard` → `/vercel/dashboard` = Hard navigation - `/vercel/dashboard` → `/vercel/dashboard/settings` = Soft navigation - `/vercel/dashboard/settings` -> `/tim/dashboard` = Hard navigation --- While adding these new heuristics some of the tests started failing and I found some state bugs in `router.reload()` which have been fixed. An example being when you push to `/dashboard` while on `/` in the same transition it would navigate to `/`, it also wouldn't push a new history entry. Both of these cases are now fixed: ``` React.startTransition(() => { router.push('/dashboard') router.reload() }) ``` --- While debugging the various changes I ended up debugging and manually diffing the cache and router state quite often and was looking at a way to automate this. `useReducer` is quite similar to Redux so I was wondering if Redux Devtools could be used in order to debug the various actions as it has diffing built-in. It took a bit of time to figure out the connection mechanism but in the end I figured out how to connect `useReducer`, a new hook `useReducerWithReduxDevtools` has been added, we'll probably want to put this behind a compile-time flag when the new router is marked stable but until then it's useful to have it enabled by default (only when you have Redux Devtools installed ofcourse). >⚠ ️ Redux Devtools is only connected to take incoming actions / state. Time travel and other features are not supported because the state sent to the devtools is normalized to allow diffing the maps, you can't move backward based on that state so applying the state is not connected. Example of the integration: <img width="1912" alt="Screen Shot 2022-09-02 at 10 00 40" src="https://user-images.githubusercontent.com/6324199/188637303-ad8d6a81-15e5-4b65-875b-1c4f93df4e44.png"> -
Shu Ding authored
This PR implements the logic to make next-app-loader able to match multiple routes. The app loader is refactored to construct the tree recursively instead of within a loop, as there could be multiple branches. Similarly, when entering a new layout level or branch, we resolve both the slot name (defaults to `"children"`) and the segment. In order to make that work, the loader has to know all matched app paths. This is passed in as the `appPaths` loader option, which is gathered when creating the entrypoint. ## Bug - [ ] Related issues linked using `fixes #number` - [x] Integration tests added - [ ] Errors have helpful link attached, see `contributing.md` ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have helpful link attached, see `contributing.md` ## Documentation / Examples - [ ] Make sure the linting passes by running `pnpm lint` - [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples) Co-authored-by:
Tim Neutkens <tim@timneutkens.nl> Co-authored-by:
JJ Kasper <jj@jjsweb.site>
-
sumiren authored
I found that `fallback: true` behaves like `fallback: blocking` when client-side page transition, but document doesn't mention the behavior. I tried following. * created a SSG page which has getStaticPaths and getStaticProps, and the getStaticProps is too slow(something like `await setTimeout(10000)`) * `next build && next start`, not `next dev` * tried page reload and client-side page transition both getServerSideProps document explains about client-side page transition. https://nextjs.org/docs/basic-features/data-fetching/get-server-side-props#when-does-getserversideprops-run On the other hand, getStaticPaths didn't explain this behavior, so I added it. ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have helpful link attached, see `contributing.md` ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have helpful link attached, see `contributing.md` ## Documentation / Examples - [x] Make sure the linting passes by running `pnpm lint` - [x] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
-
Balázs Orbán authored
Follow-up on the review comment https://github.com/vercel/next.js/pull/40182#discussion_r963036314 since the PR was merged. ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have helpful link attached, see `contributing.md` ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have helpful link attached, see `contributing.md` ## Documentation / Examples - [ ] Make sure the linting passes by running `pnpm lint` - [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
-
Balázs Orbán authored
The `next/config` code generated is incompatible with the `type: "module"` setting in `package.json`. This PR makes sure that we append the same interop code to the output `shared/lib/runtime-config` file as other re-exported modules: https://github.com/vercel/next.js/blob/93830bf04f1f40e1996f21a3534b6010d9ef3c0c/packages/next/taskfile-swc.js#L124-L128 Fixes #40159 ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have helpful link attached, see `contributing.md` ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have helpful link attached, see `contributing.md` ## Documentation / Examples - [ ] Make sure the linting passes by running `pnpm lint` - [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
-
- 05 Sep, 2022 2 commits
-
-
JJ Kasper authored
-
JJ Kasper authored
As updated in https://github.com/vercel/next.js/pull/38313 this ensures the `path` option can also be passed to `clearPreviewData` to properly clear the preview cookies. ## Bug - [x] Related issues linked using `fixes #number` - [x] Integration tests added - [ ] Errors have helpful link attached, see `contributing.md` Fixes: https://github.com/vercel/next.js/issues/39853
-