Commit Graph

516 Commits

Author SHA1 Message Date
Sebastian "Sebbie" Silbermann 871ca31e60 [app] Send errors not handled by explicit error boundaries through reportError (#76101) 2025-02-24 17:59:22 +01:00
Sebastian "Sebbie" Silbermann 58d328a0cf [test] Use new Redbox matchers in pages/ ReactRefreshLogBox (#76391) 2025-02-23 15:07:41 +01:00
Jiachi Liu 7f5a1d39e8 test: update snapshot for component stack (#76359)
The merge timing causes the test failing, update the new property for
new test
2025-02-22 04:57:35 +00:00
Jiachi Liu 922f0e927b [dev-overlay] do not attach hydration info to non hydration errors (#76349) 2025-02-22 00:57:38 +01:00
Jiwon Choi 7085190f17 [dev-overlay] restructure dev-overlay project (#76291)
- Moved source files from `_experimental/` to `ui/`.
- Moved `dev-indicators` sources out of `internal/`.
- Renamed files and variables to have explicit `app-`, `App`, `pages-`
or `Pages` prefixes for better distinguish.
  - Updated snapshots that were caused by the name change.
- Added better type to `next-runtime.webpack-config.js`.
- Moved `font/` out of `ui/`.

---------

Co-authored-by: Jiachi Liu <inbox@huozhi.im>
Co-authored-by: Jimmy Lai <laijimmy0@gmail.com>
2025-02-22 01:45:09 +09:00
Jiachi Liu 8e9f92b649 [dev-overlay] pick up build error message (#76290) 2025-02-21 14:10:39 +01:00
Jiwon Choi a89d55c011 [dev-overlay] Remove old Dev Overlay (#76256)
This PR removed the old overlay including the deprecated `buildActivity`
and `appIsrStatus` options.

Closes NDX-785
Closes NDX-855
Closes NDX-865
Closes NDX-866
Closes NDX-867
Closes NDX-868
2025-02-20 19:43:14 +09:00
Sebastian "Sebbie" Silbermann 44bdae29f9 Stop adding Owner Stacks from internals (#76231) 2025-02-20 02:16:28 +01:00
Sebastian "Sebbie" Silbermann 929e3060ab Align Redbox test helpers (#76213) 2025-02-19 16:22:31 +01:00
Sebastian "Sebbie" Silbermann c5a09d6637 Add toDisplayRedbox and toDisplayCollapsedRedbox snapshot matcher (#73621) 2025-02-19 00:49:29 +01:00
Sebastian "Sebbie" Silbermann afa34e9334 [dev-overlay] Fix off-by-one column sourcemapping in Webpack (#76152) 2025-02-18 20:39:55 +01:00
Jiachi Liu ec1fefca04 [dev-overlay] handle ssrd nextjs internal errors in overlay (#76124) 2025-02-18 12:26:24 +01:00
Sebastian "Sebbie" Silbermann 97adc814d0 Cleanup experimental.reactOwnerStack (#76123) 2025-02-17 19:20:33 +00:00
Jiwon Choi 0a4cc0a062 [dev-overlay] add error env name label (#76003) 2025-02-17 16:05:37 +09:00
Vercel Release Bot 07634b2747 Remove experimental.reactOwnerStack flag (#76021)
Co-authored-by: Sebastian Sebbie Silbermann <sebastian.silbermann@vercel.com>
2025-02-14 17:58:47 +01:00
Zack Tanner 1c85b755b5 [DevOverlay]: enable by default (#75882)
- `newDevOverlay: true` by default (enables experimental React builds on
canary until owner stacks progress further)
- `run-tests` now sets the env var for tests that were relying on it for
forking behavior
- PPR runners now run with the flag disabled to help catch regressions
in the old overlay until we remove it
- Fixed a number of tests that had outdated snapshots or missed forking
behavior because they weren't running in CI
- Disabled a test that was failing in Turbopack + Experimental React
that is unrelated to the overlay (see:
https://github.com/vercel/next.js/pull/75989)

---------

Co-authored-by: devjiwonchoi <devjiwonchoi@gmail.com>
2025-02-13 10:57:32 -08:00
Jiachi Liu 3e9846c193 [error overlay] hornor the original erroring order (#75934)
### What

Addressing the hack we introduced in #71483, where we always display the
hydration error with squashed hydration info into the first error. Now
we're displaying the errors with its own corresponding hydration info
properly, so we don't have to order it in a certain place, but just test
the displayed error itself.


Closes NDX-484
2025-02-12 05:00:24 +01:00
Jiachi Liu abb29deb31 [error overlay] fix highlighted lines (#75940)
### What

We should treat each line's first character to determine the leading
sign, rather than treating the trimed line's first character as sign.

The bad case was the close tag `>` was treated as leading error sign
```
> <p // should be treated as errored line ✅
   >   //  should not be treated as errored line ❌
```

Also align the attribute name for highlighted lines
2025-02-12 04:39:16 +01:00
Jiachi Liu 8db9dfbc81 [error overlay] align data attributes between 2 UIs (#75937)
### What

- fix data source attributes alignment
2025-02-11 18:52:04 -08:00
Jiachi Liu b70e837937 [error overlay] display different error info individually (#75916) 2025-02-12 02:51:21 +01:00
Niklas Mischkulnig c616304c48 Turbopack: use result instead of panic (#75903)
This seems to fix at least some cases of `called Option::unwrap() on a None value`.
I suspect this is because of the eventual consistency model in dev?

It also adds better error messages for the various situations.
2025-02-11 18:42:02 +01:00
Jiachi Liu f5f715168b Improve hydration diff view (#75799) 2025-02-11 14:46:57 +01:00
Hendrik Liebau b0ae0b2816 Respect no-store request header for "use cache" entries in dev mode (#75754) 2025-02-10 23:44:38 +01:00
Sebastian "Sebbie" Silbermann 026f00e294 [test] More accurate stack assertions in terminal (#75355)
Failing test highlighting breakage in https://github.com/vercel/next.js/pull/75294
2025-02-10 21:30:07 +01:00
Jude Gao 2aa2eaadc3 dev error overlay: async boundary for original stack frame call (#75718) 2025-02-10 14:47:45 -05:00
Vercel Release Bot ef6ecdb4af Upgrade React from ff628334-20250205 to 8759c5c8-20250207 (#75796)
Co-authored-by: Sebastian Sebbie Silbermann <sebastian.silbermann@vercel.com>
2025-02-10 12:08:25 +01:00
Jiachi Liu 2c592a9fc7 [error overlay] missing html tags error should be blocking (#75839)
### What

missing html tags error should always show the overlay when exist, and
the dev indicator count should be 1 since we require users to resolve
this first then React can hydrate the right content. After this they can
move to others.

Since the indicator count is not covered in old test, I add a new test
for new overlay rn, later we can merge them

#### Observed 

* Currently it requires to click the indicator to show the error
* The indicator count shows 2

#### Expected

* The overlay should pop up as it's a runtime error
* The indicator count shows 1
2025-02-09 23:50:46 +01:00
Jiachi Liu b9277bf371 Fix incorrect error count (#75759) 2025-02-07 12:58:12 +01:00
Hendrik Liebau e8b41f6e50 Add regression test for previously hanging compilation with Turbopack (#75507)
When adding or removing a `"use cache"` directive to a function or
module, Turbopack was not able to finish the compilation and hung. This
is now fixed, and we're adding the test to prevent regression.
2025-02-05 14:26:29 +00:00
rauno d70cac3eb4 [Error Overlay] Comprehensive refinement (#75471)
This PR adds a lot of polish to the experimental Error Overlay:


https://github.com/user-attachments/assets/2540b966-c61d-43eb-b816-5ef25f3ecb11

### Motion
- Stacked layers transition smoothly when switching between errors
- Height transition for the dialog panel to complement the stacked
layers transition
- Dialog contents and the backdrop fade in as per Geist Motion
Guidelines (`scale`, `opacity`)

### Design
- New language icon based on file extension à la (`app.tsx`)
- Shadows are clipped with translucent borders to visually be more crisp
- Use `backdrop-filter: blur()` for backdrop to blend with application
content
- Use `font-variant-numeric: tabular-nums` for ←→ switcher to avoid
layout shift
- Misc alignment improvements

### Interactions
- Focus is now trapped in the dialog, <kbd>Escape</kbd> will un-trap and
re-focus the last `root.activeElement`
- Focus states for all interactive elements
- Fluid reveal & collapse of ignored Call Stack items ↓




https://github.com/user-attachments/assets/59a81cea-24ec-4fe4-be00-b911ab484757

Closes NDX-711
Closes NDX-744

---------

Co-authored-by: devjiwonchoi <devjiwonchoi@gmail.com>
Co-authored-by: Zack Tanner <1939140+ztanner@users.noreply.github.com>
2025-02-04 20:37:38 -08:00
Vercel Release Bot 879e279766 Upgrade React from 37906d4d-20250127 to c492f975-20250128 (#75434) 2025-02-04 09:58:06 +00:00
Hendrik Liebau 90090ba4a3 Include HMR refresh hash in "use cache" cache keys (#75474)
Today, when editing server components that use `"use cache"` functions,
only updates to the uncached parts of the component will be reflected in
the rendered result after the HMR refresh was applied. Any cached
functions/components will show the same content as before the edit.

This is problematic when a function with a `"use cache"` directive is
edited. In this case, the edits won't be applied, and stale content is
shown in the browser, until the dev server is restarted.

With this PR, we are now including an HMR refresh hash in the cache key
for all `"use cache"` functions. This ensures that those functions are
revalidated when a server component is edited, which avoids showing
stale content.

However, while the `"use cache"` functions are revalidated during the
HMR refresh, we will still restore any fetches inside of `"use cache"`
from the [server components HMR
cache](https://nextjs.org/docs/app/api-reference/config/next-config-js/serverComponentsHmrCache)
(unless their input changed because of the edit).

For Webpack, a real content hash is used, which means that if an edit is
reverted to a prior edit, the previously cached data will be retrieved
from the cache. For Turbopack, the HMR hash is currently just an
incrementing counter, which may be improved in a follow-up PR.

closes NAR-65
2025-02-03 22:23:25 +01:00
Jiachi Liu 7c3705ded1 fix: incoming requests should use plural (#75582)
### What

Fixes the mismatch between docs and the feature code, aligning with docs
and other properties in logging option.
2025-02-03 18:31:41 +01:00
Jiwon Choi baa4f787d2 [DevOverlay] Align old and new overlay (#74935)
Enable the new UI for the CI testings of existing redbox tests.

There are several changes made to let the test pass, including
backporting changes to the old UI or removing one from the new, and are
as follows:

- Added back `|` after line number in code frame
([link](https://github.com/vercel/next.js/pull/74935#discussion_r1925725941))
- Removed unnecessary `@` in Terminal component
([link](https://github.com/vercel/next.js/pull/74935#discussion_r1925727156))
- Set open overlay default value to `true` in Pages Router
([link](https://github.com/vercel/next.js/pull/74935#discussion_r1925728104))
- Backport displaying the first first-party call stack frame to the
CallStack component
([link](https://github.com/vercel/next.js/pull/74935#discussion_r1925731313))
- Move the devTools component back to the error boundary
([link](https://github.com/vercel/next.js/pull/74935#discussion_r1925732706))
- Was moved out at
https://github.com/vercel/next.js/pull/74999#discussion_r1922998021

Closes NDX-674
Closes NDX-687
2025-01-24 06:53:32 +09:00
Zack Tanner f872b6dee5 add hostname to default error boundary message (#75151)
Since it's possible to deploy an application that triggers our default
exception handling, we should ensure the error text is personalized to
the host application to avoid any potential incorrect canonicalization
by search engines for containing duplicate content.

[slack
context](https://vercel.slack.com/archives/C01A2M9R8RZ/p1737475474278219?thread_ts=1737385764.035219&cid=C01A2M9R8RZ)
2025-01-21 16:05:27 -08:00
Mohsen Azimi 1d4a024b2f Allow disabling HTTP request logs in dev server (#74349)
Co-authored-by: Jiachi Liu <inbox@huozhi.im>
Co-authored-by: Zack Tanner <1939140+ztanner@users.noreply.github.com>
2025-01-21 23:28:07 +01:00
Jiachi Liu f140b2df6e feature(error): capture ssr error in overlay during dev (#74983) 2025-01-17 21:25:31 +00:00
Jiachi Liu 08c6275f11 test: add feature of overriding files (#74716) 2025-01-10 19:39:06 +01:00
Jiachi Liu 0d81c3c632 Fix presentation when onerror receives an event without error (#74643) 2025-01-09 20:23:33 +01:00
Jiachi Liu c14c6e0012 test: update test for async client component with snapshot (#74550)
### What

When there's a async client component used in the component tree, it's not available to display the component stack whether you enable react owner stack or not. It's likely a bug in `React.captureOwnerStack`.

We update the existing test here to ensure the error is surfaced when the mistake is comitted. We also assert on the snapshots of component stack but leave it as a TODO now since the component stack of errored component (the async client component) is not displayed.

Related to NDX-475
2025-01-06 19:19:18 +01:00
Sebastian "Sebbie" Silbermann 848c22977b Stop sourcemapping function names (#74085) 2024-12-19 20:54:35 +01:00
Jude Gao fd0028e355 Fix double rendering of ReactDevOverlay when required root tags are missing (#73993) 2024-12-16 20:21:03 -05:00
Andrew Clark 0b1eaf1298 Rename variables in LayoutRouter for clarity (#73826)
LayoutRouter has changed significantly since it was originally written
and the structure has become harder to follow. One thing I always find
confusing whenever I'm reading this code is that some of the values
correspond the the *parent* segment, while others correspond to the
*current* segment. So this moves the code around a bit and updates the
names so it's clearer which parts belong to which segments.

While working on this, I noticed a funny thing about how loading
boundaries work that was made more obvious by the revised naming. I've
left a TODO comment to follow up on whether this was intentional.
2024-12-12 10:44:59 -05:00
Jiachi Liu 74b09dd026 Remove ignore for anonymous stack frame (#73610) 2024-12-09 22:36:18 +01:00
Hendrik Liebau a28160a8f4 Dynamic IO: Improve error handling (#73607)
This PR improves error handling when `dynamicIO` is enabled.

- prevents well-known errors from being logged
- avoids unhandled rejections being logged during prerendering in dev
mode
- avoids hanging responses when well-known or unexpected errors are
thrown
- ensures pages with `notFound` used in the top level can be prerendered
statically

addresses
https://github.com/vercel/next.js/pull/73210#issuecomment-2515179765
closes NAR-48
2024-12-06 21:36:46 +00:00
Janka Uryga 82e84e430b feat(after): stabilize unstable_after (#73605)
- rename `unstable_after` -> `after`
- remove `experimental.after` flag (and warn if it's present)

i separated the big find-and-replace into a separate commit so that it's
easier to see what else changed apart from that.

does not touch docs, that's in #73038
2024-12-06 19:59:57 +00:00
Sebastian "Sebbie" Silbermann 81f6cb4b80 Ensure Issue Overlay sourcemaps externals in Turbopack (#73439)
Closes https://linear.app/vercel/issue/NDX-473/
2024-12-04 10:11:19 +01:00
Sebastian "Sebbie" Silbermann a37ac2040e Bump @swc/core to 1.9.3 (#73420)
Gets the fix for https://github.com/swc-project/swc/issues/9742
2024-12-03 10:08:56 +01:00
Janka Uryga f5e35b87b9 fix(after): allow reading draftMode status in after (#73324)
`after` was too restrictive with `draftMode` -- we generally allow reading `draftMode().isEnabled` anywhere. this is because it isn't really a dynamic API -- it's fine to call it in prerender/'use cache' contexts, because we can just prerender/cache it as `isEnabled = false`, and when it's on, it switches everything to dynamic rendering anyway, so that prerender/cache entry is ignored.

However we disallow `draftMode().enable()/disable()` in `after`, because those methods set a cookie, and `after` executes too late for that.

*(Nothing here will change in the upcoming `after` behavior update -- we fundamentally can't get more permissive than this)*
2024-11-29 11:31:53 +01:00
Jiachi Liu 64f2702413 test: fix canary test with 18.3.1 (#73327) 2024-11-28 19:47:26 +01:00