-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Conversation
@@ -103,7 +103,7 @@ export function withDirectives<T extends VNode>( | |||
updated: dir | |||
} as ObjectDirective | |||
} | |||
if (dir.deep) { | |||
if (dir && dir.deep) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a failing test case that would pass with this change?
@@ -103,6 +103,7 @@ export function withDirectives<T extends VNode>( | |||
updated: dir | |||
} as ObjectDirective | |||
} | |||
if (!dir) continue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (!dir) continue; | |
let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i] | |
if (!dir) continue; |
The main problem is that in the SSR environment, if an instruction is written on the label but not declared, an error will be reported, and the error information is not intuitive enough |
I believe this problem was fixed in #6671, so this PR can now be closed. |
Both dir and binding may be undefined, resulting in a deep error