rsnext/packages
Jiachi Liu 27ed7820a8
[error overlay] move missing tags error inside error overlay (#62993)
### What

* Move missing html tags error into error overlay, from outside we don't
have to manually determine when to render a dummy component with runtime
missing tag error or error overlay.
* Add brackets `<>` to the html tags in the error



![image](https://github.com/vercel/next.js/assets/4800338/cd3467b7-74c2-477e-8516-c31761adb064)


### Why

In #62815, we're having throwing an missing required error, this will
trigger another runtime error. Then when error overlay caught it through
error event listener, it will render it as an unhandled runtime error:

You will see the below message in the overlay.
```
Unhandled Runtime Error
Error: The following tas are missing...

[Error stack]
```

This error message will bring a message that the error is happened on
client during runtime, but actually we already know that is a user side
mistake which doesn't have a error trace. This couldn't hmr as you fix
the error as well.

This PR moves the rendering into error overlay that we're aware of the
errors and can render the correct html on client, with the `html` tag
attached with error id and `body` wrapping the error overlay. We tell
overlay that there're missing tags through props, let it handle
everything inside.

It can also hmr once you fix the error. One drawback is that when you
re-introduce the error, it might trigger react DOM updates exception
(`Failed to execute 'removeChild' on 'Node': The node to be removed is
not a child of this node.`) instead of the "missing tags" message again.
Besides that the HMR works properly.

Closes NEXT-2741
2024-03-07 14:24:00 +01:00
..
create-next-app v14.2.0-canary.6 2024-03-06 23:22:59 +00:00
eslint-config-next v14.2.0-canary.6 2024-03-06 23:22:59 +00:00
eslint-plugin-next v14.2.0-canary.6 2024-03-06 23:22:59 +00:00
font v14.2.0-canary.6 2024-03-06 23:22:59 +00:00
next [error overlay] move missing tags error inside error overlay (#62993) 2024-03-07 14:24:00 +01:00
next-bundle-analyzer v14.2.0-canary.6 2024-03-06 23:22:59 +00:00
next-codemod v14.2.0-canary.6 2024-03-06 23:22:59 +00:00
next-env v14.2.0-canary.6 2024-03-06 23:22:59 +00:00
next-mdx v14.2.0-canary.6 2024-03-06 23:22:59 +00:00
next-plugin-storybook v14.2.0-canary.6 2024-03-06 23:22:59 +00:00
next-polyfill-module v14.2.0-canary.6 2024-03-06 23:22:59 +00:00
next-polyfill-nomodule v14.2.0-canary.6 2024-03-06 23:22:59 +00:00
next-swc v14.2.0-canary.6 2024-03-06 23:22:59 +00:00
react-refresh-utils v14.2.0-canary.6 2024-03-06 23:22:59 +00:00
third-parties v14.2.0-canary.6 2024-03-06 23:22:59 +00:00