-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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(hmr): duplicate link tags #9697
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I've tested by throttling network and it actually fixed the bug. Some nitpicks but the behavior looks good to me.
packages/vite/src/client/client.ts
Outdated
@@ -126,6 +126,7 @@ function cleanUrl(pathname: string): string { | |||
} | |||
|
|||
let isFirstUpdate = true | |||
const invalidLinkTags = new Set<HTMLLinkElement>() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we could use WeakSet
to be safe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm..., I'm not sure about the client code's browser support
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are transpiling client code to es2019. So I believe it's fine.
It's easier to reproduce in my recent development, so I created this PR ~ |
Description
Fix: duplicate link tags will be generated when the style file is edited and saved too frequently.
The bug occurred when a new message push was received before the
newLinkTag
callback responded.Additional context
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).