From 362899190666a2d1f9fe23c92e9b6007721ad69f Mon Sep 17 00:00:00 2001 From: Evan You Date: Wed, 1 Sep 2021 17:27:03 -0400 Subject: [PATCH] fix(compiler): only generate non-static ref for script setup if the binding exists fix #4431 --- packages/compiler-core/src/transforms/transformElement.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/compiler-core/src/transforms/transformElement.ts b/packages/compiler-core/src/transforms/transformElement.ts index 4b142564f0a..e31a2ccbf0a 100644 --- a/packages/compiler-core/src/transforms/transformElement.ts +++ b/packages/compiler-core/src/transforms/transformElement.ts @@ -465,7 +465,12 @@ export function buildProps( // in inline mode there is no setupState object, so we can't use string // keys to set the ref. Instead, we need to transform it to pass the // acrtual ref instead. - if (!__BROWSER__ && context.inline) { + if ( + !__BROWSER__ && + value && + context.inline && + context.bindingMetadata[value.content] + ) { isStatic = false } }