27ed7820a8
### 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 |
||
---|---|---|
.. | ||
create-next-app | ||
eslint-config-next | ||
eslint-plugin-next | ||
font | ||
next | ||
next-bundle-analyzer | ||
next-codemod | ||
next-env | ||
next-mdx | ||
next-plugin-storybook | ||
next-polyfill-module | ||
next-polyfill-nomodule | ||
next-swc | ||
react-refresh-utils | ||
third-parties |