- 20 Dec, 2024 21 commits
-
-
vercel-release-bot authored
-
Jiachi Liu authored
-
Jiwon Choi authored
This PR added Geist font to be used in Dev Overlay.  Closes NDX-572
-
vercel-release-bot authored
-
Hendrik Liebau authored
When scoping the `requestStore` to dynamic renders in #72312, we missed the case when a server action is invoked before hydration is complete. This leads to an error when a server action tries to read headers, cookies, or anything else that requires the presence of the `requestStore`. This fixes that for both the Node.js and Edge runtimes. It also appears that progressively enhanced form actions did not work at all before in the Edge runtime due to a missing `await` of `decodeFormState`. fixes #73992 closes NAR-55
-
Wyatt Johnson authored
In order to simplify internal state management, this migrates internal use of query parameters over to storing details on the request metadata. Future PR's might be able to pull items off the metadata entirely and use prop drilling and the new `PageRenderContext`, `PageSharedContext`, and app equivalents.
-
Jiwon Choi authored
This PR modified the `Errors` (Runtime Error component) to use the shared `ErrorOverlayLayout`. 
-
Jiachi Liu authored
-
Tobias Koppers authored
### What? fixes the computation of `import.meta.url` inside of monorepos (when the root_path != project_path) ### How? We add a new argument to the ChunkingContext that represents the relative path from the output folder to the root of the monorepo. Since they are on different filesystems, we can't compute them from the values alone.
-
Jiwon Choi authored
Ported the ToolButtonsGroup: 
-
Jiwon Choi authored
Ported LeftIcon and RightIcon used in the pagination.
-
Jiwon Choi authored
Ported `ErrorPagination` and replaced in the `Errors` component.
-
Hendrik Liebau authored
In #73059 we added build-time checks for the forbidden usage of `this` and `arguments` in server functions. A nested function expression is however allowed to use these expressions. fixes #74181 To add a bit more context: `this` is forbidden in server actions because the Next.js compiler hoists inline server actions out of their original location into the module scope, so that they can be imported and invoked by the action handler. Due to this hoisting, the `this` context gets lost and is not available to the server action. To prevent surprising runtime errors for such cases, we emit a build error to provide feedback to developers as early as possible. However, nested function declarations or function expressions create a new `this` context, and in those it's allowed to access `this` and `arguments`. For consistency, and to prevent surprises when refactoring server actions, we apply the same rules for module-level server actions.
-
Benjamin Woodruff authored
Had a discussion with @sokra about this during office hours. We were in agreement to delete this, not because it's usually wrong, but just because it's not high-signal enough: - Many instances of `to_resolved().await` are on simple constructor calls, so it doesn't really matter if they're sequential. We could add some heuristics for this, but they'd be imperfect. - `to_resolved().await` isn't actually what drives the work forward, it's the function call that schedules the work, so in some cases this isn't accurate (and you can't know without type information). - This would make more sense if we were typically starved for work, but usually we have more tokio tasks than we can process anyways, so increasing parallelism is unlikely to help in most cases. - Some code isn't performance sensitive (e.g. internal CLI utilities, tests), so this is just noise in those places.
-
Benjamin Woodruff authored
`OperationVc`s should be used with `CollectiblesSource` instead of `Vc`s because collectibles represent a side-effect or implicit extra return value of a function's execution. This PR doesn't convert all callsites, just a handful.
-
JJ Kasper authored
Currently we are using `pendingWaitUntil` on `renderOpts` to handle pending revalidations (fetch updates and revalidate tag calls). This uses our old strategy of `waitUntil` inside of `sendResponse` which just keeps the stream open until the promise resolves. This isn't ideal if we have a proper waitUntil strategy provided so this updates to ensure we use that instead if available. Also adds some debug logs so we can track when this pending revalidates promise is resolved.
-
Benjamin Woodruff authored
- We should generally prefer `try_join` over `to_resolved().await` in a loop as it can provide more parallelism. - Some of these should just resolve the `Vc` outside the loop.
-
Benjamin Woodruff authored
I started writing this PR by requiring `OperationValue` in `State`: ```diff impl<T> State<T> { - pub fn new(value: T) -> Self { + pub fn new(value: T) -> Self + where + T: OperationValue, + { ``` And then went through changing every compilation error that occurred as a result. ## Hacks **There are some hacks in a number of places here where we incorrectly convert `ResolvedVc` to `OperationValue`.** Unfortunately these have to exist because it's impractical to convert everything to `OperationValue`. `OperationValues` are harder to construct as they must be created directly from the return value of an unresolved function call. ## Why does `State<T>` need `T: OperationValue`? `OperationVc` types require that `.connect()` is called before their value can be read. As an internally-mutable type, `State` allows `Vc`s to be passed in ways that we cannot track. `.connect()` re-connects the `Vc` to the dependency graph so that strong resolution is possible. Without this, you might end up with stale results when reading a `Vc` inside of `State`, which can be very hard to debug. Fundamentally, I think `State` is unsound, but this is a band-aid on it until we can migrate to a better solution (likely effect-style `Collectibles` for `VersionedContentMap`). -
Benjamin Woodruff authored
refactor(turbo-tasks): Remove public OperationVc constructor, introduce a macro annotation for creating OperationVc types (#72871) Introduces a new `operation` argument to the `#[turbo_tasks::function]` macro for creating functions that return `OperationVc`: ``` // this function's external signature returns an `OperationVc` #[turbo_tasks::function(operation)] async fn multiply(value: OperationVc<i32>, coefficient: i32) -> Result<Vc<i32>> { Ok(Vc::cell(*value.connect().await? * coefficient)) } ``` This is important to solve a few major footguns with manually-constructed `OperationVc`s: - It can be hard to know if a `Vc` is an operation or not, and the only warning you'd get if you got it wrong was a runtime error. - Local-task-based resolution (#69126) will implicitly create local `Vc`s if an argument isn't resolved. - ~We want to enforce that all arguments to `OperationVc`-returning functions are also `OperationVc`s or non-`Vc` values. Otherwise you could end up with a stale/wrong `OperationVc`.~ Scrapped, this was too hard/impractical, see below. This removes the public constructor. Methods are not currently supported because: 1. Operations are uncommon, and it's not worth the effort, IMO. 2. There's no way to make it work for dynamic-dispatched method calls, as we cannot resolve the type of `self`. It could be made to work for inherent impls and non-object trait types. --- This is basically implementing @sokra's TODO comment in the old `OperationVc::new` constructor: ``` // TODO to avoid this runtime check, we should mark functions with `(operation)` and return // a OperationVc directly ``` But with assertions for the function arguments, based on some discussion in DMs: <img src="https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/HAZVitxRNnZz8QMiPn4a/13952614-f421-4c8a-99b8-3ce5f19715ae.png" width="600"/> We allow *either* `ResolvedVc` or `OperationVc` as arguments because: - Only accepting `OperationVc` arguments was impossible to refactor to, as this made it "viral" and there are too many places where we need to use operations that have too many dependencies. - While it makes sense for `State` to require `OperationVc` as arguments to any operation (keeps the whole dependency/call tree alive), for collectibles, sometimes you want the arguments to be `ResolvedVc`. It's just a matter of if you want to include collectibles generated when creating the arguments or not. -
Benjamin Woodruff authored
These tests exist to see that the compiler generates errors when doing similar things to what the lint is designed to catch. I'd rather exempt these in the lint than in the trybuild tests, as once we get rid of support for the `local` opt-out in the `turbo_tasks::value` macro, we shouldn't need the lint anymore (it won't be possible to compile code using an unresolved `Vc` in a `VcValueType`), but we still will need these trybuild tests.
-
Zack Tanner authored
Similar to #73138, this removes the direct usage of `jest-worker` for the linting/typechecking step in favor of the shared worker that has built-in handling for propagating errors to the parent process. This is to ensure that if the worker performing the typechecking/linting receives a SIGKILL signal (which could happen with an OOM error), that the parent process exits appropriately.
-
- 19 Dec, 2024 14 commits
-
-
vercel-release-bot authored
-
Vercel Release Bot authored
-
Benjamin Woodruff authored
A pretty easy/straightforward migration.
-
Sebastian "Sebbie" Silbermann authored
-
Jiwon Choi authored
Ported `ErrorIndicator`. Also, moved "error-specific" component combinations to `internal/componentsErrors/` to distinguish better.
-
Sebastian "Sebbie" Silbermann authored
-
Janka Uryga authored
adds types to node modules require()d in the node runtime. these imports were untyped, which was hiding an issue with our `pathToFileUrl` usage.
-
Michael H authored
-
Tobias Koppers authored
### What? Improved trace source maps to return relative paths and always relative to process.cwd. `turbopack://` urls in SourceMaps are always relative to the project root. `file://` urls do no longer contain duplicate path segments. Add a test case Also: * improve error when sourcemap lookup throws
-
Niklas Mischkulnig authored
- Before, there was a separate AST traversal that collected `next-dynamic` imports - Now, we use transitions (which are inserted by the existing next-custom-transform) to tell Turbopack about the next-dynamic imports - Unlike Webpack (where the react-loadable identifiers are `path/to/parent-module -> ./imported-client`), Turbopack just uses the module id: `[project]/path/to/imported-client.js [app-client] (ecmascript, next/dynamic entry)` - the `next-dynamic` transition only inserts the marker module (i.e. for the SSR `import()`) - the `next-dynamic-client` transition inserts the marker module and changes the module context (used to get the client module name) - Now, we use the correct `AvailabilityInfo` for the next/dynamic chunks to preload, and they are not explicitly emitted. If they are for some reason not the same chunks that are actually emitted for the dynamic import, you get a hard error. (Previously, they didn't use the same `AvailabilityInfo` as the real async chunks, so they usually bundled another copy of React, and also had a different chunk name hash) - For Turbopack, react-loadable manifests are now scoped per page instead of globally
-
Niklas Mischkulnig authored
Revert the revert in https://github.com/vercel/next.js/pull/74029 Was a regression of https://github.com/vercel/next.js/pull/73322
-
Jiwon Choi authored
Changed filename `root-layout-missing-tags-error.tsx` to `RootLayoutMissingTagsError.tsx`. Synced with old UI also.
-
Niklas Mischkulnig authored
This is an arbitrary decision, but a "regular" sync import is `ParallelInheritAsync`. This creates less intermediate notes when building the graph
-
Ali Tas authored
### What? This PR updates the fallback type for typed routes to match the one in https://github.com/vercel/next.js/blob/canary/packages/next/src/types.ts#L58. ### Why? During builds, the `Route` type is initialized as the fallback type before being populated by the routes. This causes temporary type warnings in the project, since a route like `"" | Route` becomes `"" | string` which can raise an ts-eslint error like `"" is overridden by string in this union type`. This becomes a problem in both failed builds, and in CI where a linter and a build can run in parallel. Updating the type to match the stub type fixes the issue. Co-authored-by:
Sam Ko <sam@vercel.com> Co-authored-by:
JJ Kasper <jj@jjsweb.site>
-
- 18 Dec, 2024 5 commits
-
-
vercel-release-bot authored
-
Jiwon Choi authored
### Why? This PR refactored overlay to have a common layout as they share much in common and are also better for testing the layout. Will follow up with `Errors` component as it needs some UI break downs. Note: patched `@storybook/react` for the type error: - https://github.com/vercel/next.js/actions/runs/12394130672/job/34596896487#step:8:565
-
Sebastian "Sebbie" Silbermann authored
-
Jude Gao authored
This pull request adds telemetry collection for error message feedback in the development server. It exposes an internal endpoint `/__nextjs_error_feedback` for the error overlay to call. https://linear.app/vercel/issue/NDX-597/create-error-feedback-ui-that-fires-events-to-next-telemetry
-
Janka Uryga authored
we've seen these tests flake with this error: ``` expect(received).toBe(expected) // Object.is equality Expected: 0 Received: null 234 | // App finally shuts down 235 | await appKilledPromise > 236 | expect(app.exitCode).toBe(0) | ^ 237 | }) 238 | }) 239 | } at Object.toBe (production/graceful-shutdown/index.test.ts:236: ``` this PR doesn't fix that, but it should make it easier to see why the code was `null` -- if signal is nonnull, we'll see what it was. note: `once(app, 'exit')` returns the arguments passed to the `exit` callback, which are `(code, signal)`
-