Skip to content

Commit 7971b04

Browse files
committed
fix(directives): ignore invalid directive hooks
fix #795
1 parent 27afbaf commit 7971b04

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

packages/runtime-core/src/directives.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,9 @@ export function withDirectives<T extends VNode>(
126126
}
127127
// inject onVnodeXXX hooks
128128
for (const key in dir) {
129-
if (!injected[key]) {
130-
const { 0: hookName, 1: hook } = directiveToVnodeHooksMap[key]
129+
const mapped = directiveToVnodeHooksMap[key]
130+
if (mapped && !injected[key]) {
131+
const { 0: hookName, 1: hook } = mapped
131132
const existing = props[hookName]
132133
props[hookName] = existing ? [].concat(existing, hook as any) : hook
133134
injected[key] = true

0 commit comments

Comments
 (0)