next.js
69776cc3 - [dev-overlay] remove special handling for missing tag error (#77147)

Commit
329 days ago
[dev-overlay] remove special handling for missing tag error (#77147) ### What We had a few existing hacks for the missing html tag errors, we used a lot of tricks and components to deal with it specifically. It was quite a pain to handle on specific error across the entire codebase. This PR leverage the existing SSR error template we sent through the rendering. We now inject a open `<html>` tag to intercept the HTML. And then it will be consumed as a SSR error. We added one more thing that we'll open the error overlay automatically by default. It doesn't have to be build error since the display was not ideal. Now it's just one of the normal error, such like it can show the version indicator as well. Except we had a little bit logic to make it pop up by default. The idea is to insert a piece of errored html like what we expect for erroring rendered html. So it inserts a new start point of the html, and then React will hydrate it with the error template. ```html <!-- layout / page content --> <meta .. /> <script .. /> <!-- we insert a html for missing tag error --> <html id="__next_error__"> <template data-next-error-message=".." ..></template> <!-- next.js always render close tag --> </body> </html> ``` | After | Before | |:-- |:--| | <img width="1048" alt="image" src="https://github.com/user-attachments/assets/713812cf-50cd-4b14-8906-44ed3795ef12" /> | <img width="1020" alt="image" src="https://github.com/user-attachments/assets/ac7614d9-da3b-48d1-bab1-c97355c27963" /> |
Author
Parents
Loading