Skip to content

fix: fix accumulated stacks in error overlay#16393

Merged
sapphi-red merged 4 commits into
vitejs:mainfrom
hi-ogawa:fix-ErrorOverlay-stack-overwrite
Apr 13, 2024
Merged

fix: fix accumulated stacks in error overlay#16393
sapphi-red merged 4 commits into
vitejs:mainfrom
hi-ogawa:fix-ErrorOverlay-stack-overwrite

Conversation

@hi-ogawa
Copy link
Copy Markdown
Contributor

@hi-ogawa hi-ogawa commented Apr 10, 2024

Description

This looks like a regression of #15852. Since template element became a singleton, when I show the error overlay programatically with server.hot.send, it accumulates the messages in .stack due to the mutation here:

el.appendChild(document.createTextNode(frag))

The same test case looks like this in main:

Show screenshot

image

which now looks like this:

image

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 template is fresh, but when trying to show overlay multiple times, the stacks keep accumulating.

I suppose calling createTemplate every time wouldn't hurt much, so I simply removed template singleton. Before the PR #15852, it was innerHTML assignment, so I think it was making a fresh copy similarly.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

p3-minor-bug An edge case that only affects very specific usage (priority)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants