rsnext/test
Jiachi Liu 7525633427
DX: display highlited pesudo html when bad nesting html error occurred (#62590)
### What

When you have bad nesting html in your React code, React wil raise
hydration error since the browser html parser might parse it to sth else
different comparing to server html on client. Previously we're display
only the warning in the error description in dev overlay.

Now we introduced another format of displaying pesudo html that
representing your code, with highlighting the html tag that causes the
error. Since React might gives you the whole component stack of React
tree, so we also introduced a way that can collapse the error.

#### Example


https://github.com/vercel/next.js/assets/4800338/622122d6-4d2e-4c8e-95e8-4864343e478b

### Why
The reason we added this is that even we show the html diff, it could
super large due to React ordering the html on client, so the mismatch
might be a lot. The idea here is similar to what you saw when you passed
down a bad event handler into server component, we displayed a pesudo
html as it could hit your mind faster than just seeing the warning. The
best way is to display the source code, but before we can show the
source, getting component stack display as pseudo html instead of here
could be more helpful.



### After vs Before

<img width="400"
src="https://github.com/vercel/next.js/assets/4800338/714119ad-ff23-46a9-bc5a-5601eb390e71">
<img width="400"
src="https://github.com/vercel/next.js/assets/4800338/575f95fa-889e-4cee-ad19-9c2fea06519a">



Closes NEXT-2621
2024-02-28 16:14:48 +01:00
..
.stats-app Reduce memory/cache overhead from over loader processing (#62005) 2024-02-13 22:40:19 +00:00
development DX: display highlited pesudo html when bad nesting html error occurred (#62590) 2024-02-28 16:14:48 +01:00
e2e Fix: generateSitemaps in production giving 404 (#62212) 2024-02-28 12:43:07 +01:00
examples feat(cli): introduce --tailwind flag (#46927) 2023-03-16 16:06:27 +01:00
integration Ensure dynamic routes dont match _next/static unexpectedly (#62559) 2024-02-27 15:01:16 -08:00
lib DX: display highlited pesudo html when bad nesting html error occurred (#62590) 2024-02-28 16:14:48 +01:00
production Tree shake the unused exports in direct relative imported client component module (#62238) 2024-02-20 17:07:25 +01:00
unit fix:(next/image) handle remotePatterns with a dot in the pathname (#60488) 2024-02-08 18:21:29 -05:00
.gitignore ci(workflow): enable test trace upload (#51107) 2023-06-12 17:14:13 +00:00
build-turbopack-tests-manifest.d.ts Update Turbopack test manifest from GitHub Actions artifact (#58394) 2023-11-24 16:48:12 +01:00
build-turbopack-tests-manifest.js tests are no longer flaky (#62278) 2024-02-20 14:44:11 +01:00
get-test-filter.js run tests from test suite that are not listed in the manifest (#58401) 2024-01-11 07:38:35 +00:00
jest-setup-after-env.ts Decrease default test timeouts (#56116) 2023-09-27 23:55:20 +00:00
ppr-tests-manifest.json Renew prefetch cache entry after update from server (#61573) 2024-02-20 09:07:18 -08:00
readme.md
test-file.txt
tsconfig.json chore: extends from shared base tsconfig (#59776) 2023-12-19 18:52:22 +01:00
turbopack-tests-manifest.json feat(turbopack): Sort issues (#62566) 2024-02-27 19:07:32 +00:00

See Testing for more information on how you can run/write/debug tests for Next.js.