From 75c8ff5cb745123ff3fe80ff347cca73694870a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E6=99=BA=E5=AD=90=20Kevin=20Deng?= Date: Wed, 7 Feb 2024 20:38:12 +0800 Subject: [PATCH] fix(runtime-vapor): update old value even if no beforeUpdate hook --- packages/runtime-vapor/src/directive.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/runtime-vapor/src/directive.ts b/packages/runtime-vapor/src/directive.ts index 43539f647..9bff0a8eb 100644 --- a/packages/runtime-vapor/src/directive.ts +++ b/packages/runtime-vapor/src/directive.ts @@ -129,11 +129,11 @@ function callDirectiveHook( instance: ComponentInternalInstance | null, name: DirectiveHookName, ) { + if (name === 'beforeUpdate') binding.oldValue = binding.value const { dir } = binding const hook = dir[name] if (!hook) return - if (name === 'beforeUpdate') binding.oldValue = binding.value const newValue = binding.source ? binding.source() : undefined binding.value = newValue // disable tracking inside all lifecycle hooks