Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix accumulated stacks in error overlay #16393

Merged
merged 4 commits into from Apr 13, 2024

Conversation

hi-ogawa
Copy link
Collaborator

@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.

Copy link

stackblitz bot commented Apr 10, 2024

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@hi-ogawa hi-ogawa changed the title fix: fix error overlay stack message when calling fix: fix accumulated stacks in error overlay Apr 10, 2024
@hi-ogawa hi-ogawa marked this pull request as ready for review April 10, 2024 10:32
bluwy
bluwy previously approved these changes Apr 11, 2024
@bluwy bluwy added the p3-minor-bug An edge case that only affects very specific usage (priority) label Apr 11, 2024
Copy link
Member

@sapphi-red sapphi-red left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Thanks!

playground/html/__tests__/html.spec.ts Outdated Show resolved Hide resolved
@sapphi-red sapphi-red enabled auto-merge (squash) April 13, 2024 14:47
@sapphi-red sapphi-red merged commit 102c2fd into vitejs:main Apr 13, 2024
10 checks passed
@hi-ogawa hi-ogawa deleted the fix-ErrorOverlay-stack-overwrite branch April 13, 2024 23:21
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.

None yet

3 participants