next.js
64b69ff0 - Avoid duplicate WebSocket connection for global error pages (#82788)

Commit
240 days ago
Avoid duplicate WebSocket connection for global error pages (#82788) When we're rendering a global error page (something with `<html id="__next_error__">`), we are wrapping the root element in a component that renders a top-level dev overlay to show the global error. The function that's wrapping this element was previously creating an unnecessary second WebSocket connection to handle the case where the error is removed by editing a server component, and the page is subsequently reloaded. However, this can be handled by the first WebSocket connection that's created in the root element just fine, we just need to ensure that the reload is also triggered when `document.documentElement.id` is `'__next_error__'`, which is the same [condition we use for rendering the wrapper](https://github.com/vercel/next.js/blob/a0b7a725a1b424473940fe3111842ae92d918a25/packages/next/src/client/app-index.tsx#L275). This change is covered by existing tests, e.g. `test/development/app-dir/missing-required-html-tags/index.test.ts`.
Author
Parents
Loading