Skip to content

Commit f866c46

Browse files
edison11059romise
authored andcommitted
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 4f8f0aa commit f866c46

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
@@ -10,7 +10,9 @@ export interface VShowElement extends HTMLElement {
1010
[vShowHidden]?: boolean
1111
}
1212

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

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

0 commit comments

Comments
 (0)