Commit Graph

1310 Commits

Author SHA1 Message Date
Jiwon Choi 1c9e8af8bb [dev-overlay] hide dev indicator for server session or 1 day (#76430)
### Why?

When users want to hide the dev indicator, they might be frustrated if
it reappears every reload. Hence, make a default to hide it for the
current server session or a day.

Closes NDX-890

---------

Co-authored-by: Zack Tanner <1939140+ztanner@users.noreply.github.com>
2025-02-25 13:51:54 -08:00
Zack Tanner e071b839e4 [dev-overlay]: wire up ISR status for pages router (#76458)
The static indicator was added in the new dev overlay but wasn't hooked up to pages router. This wires that up so they're properly marked static/dynamic. 

Closes NDX-897
2025-02-25 12:05:45 -08:00
Vercel Release Bot 35eb671e0e Upgrade React from 25677265-20250224 to 22e39ea7-20250225 (#76481)
Co-authored-by: Sebastian Sebbie Silbermann <sebastian.silbermann@vercel.com>
2025-02-25 15:05:56 +01:00
Sebastian "Sebbie" Silbermann 86aef9d9bc Only log unrecoverable SSR shell errors once (#76484) 2025-02-25 14:45:10 +01:00
Niklas Mischkulnig 63f2a78fee Turbopack: unique node middleware layer name (#76447) 2025-02-25 09:09:08 +01:00
Jiachi Liu 7a0d1b4923 [test] fix client navigation error count in react 18 (#76442) 2025-02-24 20:42:14 +01:00
Sebastian "Sebbie" Silbermann 94d97d12d8 [test] Use new Redbox matchers in app/ ReactRefreshLogBox (#76431) 2025-02-24 17:59:52 +01:00
Sebastian "Sebbie" Silbermann 871ca31e60 [app] Send errors not handled by explicit error boundaries through reportError (#76101) 2025-02-24 17:59:22 +01:00
Will Binns-Smith 01f63576c3 toDisplayRedbox() matcher: trim line endings (#76404) 2025-02-24 11:18:36 +01:00
Zack Tanner 025657cf90 [dev-overlay]: hiding devtools shouldn't hide errors (#76399)
Currently when you select "Hide Dev Tools", if an error comes in you
won't see the error indicator anymore.

This follows the same treatment as when the indicator is disabled in
next config, which is to only show you errors, and not the regular
indicator/popover.
2025-02-23 17:30:00 +00:00
Sebastian "Sebbie" Silbermann 4095ecb588 [test] Use new Redbox matchers in app/ ReactRefreshLogBox-builtins (#76394) 2025-02-23 15:25:43 +01:00
Sebastian "Sebbie" Silbermann 58d328a0cf [test] Use new Redbox matchers in pages/ ReactRefreshLogBox (#76391) 2025-02-23 15:07:41 +01:00
Sebastian "Sebbie" Silbermann 0b49048a62 [test] Use new Redbox matchers in pages/ ReactRefreshLogBox-builtins (#76392) 2025-02-23 11:42:31 +01:00
Sebastian "Sebbie" Silbermann 05f4b8773c [test] Use new Redbox matchers in pages/ error-recovery test (#76348) 2025-02-23 09:05:02 +01:00
Will Binns-Smith ad4977a757 Update error-recovery test snapshots for alternative bundler (#76299)
Passes an additional 4 tests for Rspack. Rspack error messages included
trailing whitespace when written to the DOM, so these are stripped out.
2025-02-22 22:42:11 +00: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
Sebastian "Sebbie" Silbermann d5cefb2606 [test] Use new Redbox matchers in pages/ hydration-error test (#76350) 2025-02-22 00:01:27 +01:00
Sebastian "Sebbie" Silbermann 69333f5140 [dev-overlay] Isolate overlay from user space Components (#76277) 2025-02-21 20:48:34 +00: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
Zack Tanner a15897beba [errors]: default export error should distinguish between layout/page (#76294)
When you forget to export a component in the layout, the error message
points you to the page component, which is confusing.

This ensures the error points to the module that's missing the export. 

Closes NDX-874
2025-02-20 12:46:25 -08: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
Jude Gao ef42b84e34 [dev-overlay] use absolute font src url (#76229)
Fix font loading from a non-root URL:

Repro:
```
pnpm next dev test/development/app-dir/owner-stack/
```
and Visit http://localhost:3000/browser/uncaught

Shows
```
GET /browser/__nextjs_font/geist-latin.woff2 404 in 330ms
```
2025-02-19 17:42:57 -05:00
Sebastian "Sebbie" Silbermann 034972215c Consolidate next/link error tests (#76214) 2025-02-19 23:34:04 +01:00
Sebastian "Sebbie" Silbermann 739646224a Fix stale snapshots (#76237) 2025-02-19 22:13:02 +01:00
Sebastian "Sebbie" Silbermann 929e3060ab Align Redbox test helpers (#76213) 2025-02-19 16:22:31 +01:00
Jude Gao 9966e7e1b3 [dev-overlay] fix Geist fonts (#76166)
### What?

Two issues need to be solved:
1. Font isn't working. Dev overlay uses Geist fonts. Currently does not
work if they are not installed in OS.
2. Even if fonts worked, we would be downloading fonts from Google for
the dev overlay, which is not ideal for slow internet & users with
restricted access to Google.

### Why?

**Reason to (1):** Styles defined inside Shadow DOM cannot contain
`@font-face`. Custom fonts should be defined in the main container and
can be accessed in Shadow DOM. Read this
[post](https://robdodson.me/posts/at-font-face-doesnt-work-in-shadow-dom/).

### How?

To solve (1), we simply lift the font styles outside the Shadow DOM.
To solve (2), we introduce a new dev middleware for the dev-server that
serves the font assets & we modify the taskfile to move the woff2 fonts
to the dist folder.


Closes NDX-834
2025-02-18 23:55:12 -05: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
Jiwon Choi f0887fa068 test: replace explicit padding-bottom with devIndicators: false for scroll position testing (#76105)
### Why?

There were explicit `paddingBottom: 60` set to fixtures due to the dev
indicator blocking the scroll position. Since an option to disable it
was added at https://github.com/vercel/next.js/pull/76079, this PR
replaced them with `devIndicators: false`.

x-ref:
https://github.com/vercel/next.js/pull/76077#discussion_r1957164641
2025-02-18 06:03:58 +09:00
Sebastian "Sebbie" Silbermann c02bca2322 Current behavior for reportError (#76115) 2025-02-17 22:02:08 +01:00
Sebastian "Sebbie" Silbermann 97adc814d0 Cleanup experimental.reactOwnerStack (#76123) 2025-02-17 19:20:33 +00:00
Xiaoyi d69f796522 Bump webpack to 5.98.0 (#75847)
Co-authored-by: Sebastian Sebbie Silbermann <sebastian.silbermann@vercel.com>
2025-02-17 14:44:13 +01: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
Jude Gao 785e9660d4 Fix: Build error causes infinite loop on new dev overlay in Turbopack (#75984)
### What?

When you enable both Turbopack, and the new dev overlay, you will see
that the dev overlay is frozen and the network tab shows that it is
fetching the stack frames API indefinitely.

### Why?

​During our migration to the new development overlay, we implemented a
refactor to ensure that logic for handling runtime errors is executed
consistently, even in the case of build-time errors. This change
involves invoking the getErrorByType function for build errors. However,
this function attempts to retrieve stack frames for the build-time
error, inadvertently triggering Turbopack to initiate a rebuild.

Once Turbopack completes the rebuild process, it dispatches a Hot Module
Replacement (HMR) event to indicate the presence of a new error. This
event prompts getErrorByType to attempt fetching the stack frames again,
which in turn causes Turbopack to rebuild once more. This creates an
endless loop of rebuilding and error signaling.

You can repro it by running
```
__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY='true' TURBOPACK=1 pnpm testonly-dev test/development/acceptance-app/editor-links.test.ts
```
with the test file change in this PR. (Important to add that. Otherwise
the test would still complete successfully)

### How?

Do not run the runtime error logic for build errors.


Closes NDX-816
2025-02-13 16:23:06 -05:00
Jiwon Choi 959a312143 ci: fix version-staleness test (#76020)
The test failed since https://github.com/vercel/next.js/pull/75882 was
merged with a lot of test changes, but
https://github.com/vercel/next.js/pull/75768 didn't rebase.
2025-02-13 20:07:47 +00: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
Janka Uryga eac707f0e7 fix: compiler error when next/cache is used in a client module (#75979)
Most functions in `next/cache` don't work on the client, and produce
confusing error messages when called there. It's better to just ban them
at compile time.

NOTE: For legacy/compat reasons, we're allowing `unstable_cache` and
`unstable_noStore`, since they don't currently throw when called.
2025-02-12 20:27:21 +00:00
Sebastian "Sebbie" Silbermann 663ef48fae Fix flaky error-recovery test (#75948) 2025-02-12 12:45:33 +01:00
Hendrik Liebau 07e6680ddf Restore --no-mangling CLI option for next build (#75921)
The `--no-mangling` CLI option for `next build` was originally
introduced in #42633. However, we lost this feature during our migration
from Terser to SWC. As part of broader improvements for debugging
dynamic accesses with Dynamic I/O enabled, I needed this functionality
back, so I restored it for Webpack and also added it to Turbopack.

fixes #67037
fixes #50208

---------

Co-authored-by: Benjamin Woodruff <benjamin.woodruff@vercel.com>
2025-02-12 11:08:03 +00: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
Zack Tanner 9ffd729e8a [DevOverlay]: render indicator in pages router (#75918)
We weren't rendering the new indicator when used in pages router -- `isMounted` was only true when there was an error. This PR keeps the `isMounted` logic for the old overlay but removes it for the new one.
2025-02-11 13:50:20 -08: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