Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(runtime-core): Error problem in custom instruction SSR environment #4273

Closed
wants to merge 7 commits into from
4 changes: 2 additions & 2 deletions packages/runtime-core/src/directives.ts
Expand Up @@ -103,7 +103,7 @@ export function withDirectives<T extends VNode>(
updated: dir
} as ObjectDirective
}
if (dir.deep) {
if (dir && dir.deep) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if dir is undefined, it should jump out of the current loop.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we should really jump out of the loop. At present, such judgment and processing can also achieve the expected effect.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have complete reading logic. Thank you for reminding me.

traverse(value)
}
bindings.push({
Expand Down Expand Up @@ -131,7 +131,7 @@ export function invokeDirectiveHook(
if (oldBindings) {
binding.oldValue = oldBindings[i].value
}
let hook = binding.dir[name] as DirectiveHook | DirectiveHook[] | undefined
let hook = binding && binding.dir && binding.dir[name] as DirectiveHook | DirectiveHook[] | undefined
if (__COMPAT__ && !hook) {
hook = mapCompatDirectiveHook(name, binding.dir, instance)
}
Expand Down