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): ensure functional component's context parameter is not null. (fix: #6580 ) #6581

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

yangjunjun
Copy link

@yangjunjun yangjunjun commented Sep 2, 2022

When funtional component's props has default value, the length of this funtional componet will be 0, which will cause the second paramter to be null, as the issue show. so the solution is always keep the second paramters have value.
the same as componet's setup option.

MDN docs of Function.length:

length is a property of a function object, and indicates how many arguments the function expects, i.e. the number of formal parameters. This number excludes the rest parameter and only includes parameters before the first one with a default value. By contrast, arguments.length is local to a function and provides the number of arguments actually passed to the function.

fix #6580

… not null when props parameter has a default value
@netlify
Copy link

netlify bot commented Sep 2, 2022

Deploy Preview for vue-sfc-playground failed.

Name Link
🔨 Latest commit 54904a3
🔍 Latest deploy log https://app.netlify.com/sites/vue-sfc-playground/deploys/6311b8241c040b0008896b89

@haoqunjiang
Copy link
Member

See #6580 (comment)
The PR does have fixed an edge case so I leave it open.

But as said in the linked issue, I'm not even sure if it's worth fixing. So I marked this as p1-chore, and will only review it when we have much spare time.

@haoqunjiang haoqunjiang added the 🧹 p1-chore Priority 1: this doesn't change code behavior. label Apr 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🧹 p1-chore Priority 1: this doesn't change code behavior. need discussion
Projects
Status: Needs Review
Development

Successfully merging this pull request may close these issues.

Using default parameter for functional component props will cause context paramter to be null
3 participants