Skip to content

Commit 3628991

Browse files
committed
fix(compiler): only generate non-static ref for script setup if the binding exists
fix #4431
1 parent 168a17a commit 3628991

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/compiler-core/src/transforms/transformElement.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,12 @@ export function buildProps(
465465
// in inline mode there is no setupState object, so we can't use string
466466
// keys to set the ref. Instead, we need to transform it to pass the
467467
// acrtual ref instead.
468-
if (!__BROWSER__ && context.inline) {
468+
if (
469+
!__BROWSER__ &&
470+
value &&
471+
context.inline &&
472+
context.bindingMetadata[value.content]
473+
) {
469474
isStatic = false
470475
}
471476
}

0 commit comments

Comments
 (0)