fix: fix accumulated stacks in error overlay#16393
Merged
sapphi-red merged 4 commits intoApr 13, 2024
Merged
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This looks like a regression of #15852. Since
templateelement became a singleton, when I show the error overlay programatically withserver.hot.send, it accumulates the messages in.stackdue to the mutation here:vite/packages/vite/src/client/overlay.ts
Line 269 in 5f0e6a3
The same test case looks like this in main:
Show screenshot
which now looks like this:
The background is that, I'm currently trying runtime error overlay ideas like #6274 and then I just spotted this odd behavior. Normally, the error overlay seems to happen after full client reload, so
templateis fresh, but when trying to show overlay multiple times, the stacks keep accumulating.I suppose calling
createTemplateevery time wouldn't hurt much, so I simply removedtemplatesingleton. Before the PR #15852, it wasinnerHTMLassignment, so I think it was making a fresh copy similarly.