Skip to content

Commit 1031e8d

Browse files
authored
fix(runtime-dom): add name to vShow for prop mismatch check (#13806)
close #13805 re-fix #13744 revert #13777 The implementation in #13777 requires users to configure __FEATURE_PROD_HYDRATION_MISMATCH_DETAILS__, otherwise errors like #13805 will occur.
1 parent 0f916d8 commit 1031e8d

File tree

1 file changed

+3
-5
lines changed
  • packages/runtime-dom/src/directives

1 file changed

+3
-5
lines changed

packages/runtime-dom/src/directives/vShow.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ export interface VShowElement extends HTMLElement {
99
[vShowHidden]: boolean
1010
}
1111

12-
export const vShow: ObjectDirective<VShowElement> & { name?: 'show' } = {
12+
export const vShow: ObjectDirective<VShowElement> & { name: 'show' } = {
13+
// used for prop mismatch check during hydration
14+
name: 'show',
1315
beforeMount(el, { value }, { transition }) {
1416
el[vShowOriginalDisplay] =
1517
el.style.display === 'none' ? '' : el.style.display
@@ -45,10 +47,6 @@ export const vShow: ObjectDirective<VShowElement> & { name?: 'show' } = {
4547
},
4648
}
4749

48-
if (__DEV__ || __FEATURE_PROD_HYDRATION_MISMATCH_DETAILS__) {
49-
vShow.name = 'show'
50-
}
51-
5250
function setDisplay(el: VShowElement, value: unknown): void {
5351
el.style.display = value ? el[vShowOriginalDisplay] : 'none'
5452
el[vShowHidden] = !value

0 commit comments

Comments
 (0)