8000 fix(hydration): avoid hydration mismatch on style variables with falsy values by yangxiuxiu1115 · Pull Request #12442 · vuejs/core · GitHub
[go: up one dir, main page]

Skip to content

fix(hydration): avoid hydration mismatch on style variables with falsy values #12442

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

Closed
wants to merge 8 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: update
  • Loading branch information
yangchangtao committed Nov 20, 2024
commit 95738bb8cd379365b3af8f34a8867c4e9e282a5e
5 changes: 1 addition & 4 deletions packages/runtime-core/src/hydration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -940,10 +940,7 @@ function resolveCssVars(
for (const key in cssVars) {
const value = cssVars[key]
if (isString(value) || typeof value === 'number') {
Copy link
Member

Choose a reason for hiding this comment

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

should also take into account an empty string
see Playground with this PR

Copy link
Member

Choose a reason for hiding this comment

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

Do we even need to take care of values apart from null and undefined here? Even a string can cause mismatch here. eg. ";"

expectedMap.set(
`--${getEscapedCssVarName(key, false)}`,
String(cssVars[key]),
)
expectedMap.set(`--${getEscapedCssVarName(key, false)}`, String(value))
}
}
}
Expand Down
0