core icon indicating copy to clipboard operation
core copied to clipboard

fix(runtime-core): ensure functional component's context parameter is not null. (fix: #6580 )

Open yangjunjun opened this issue 3 years ago • 2 comments

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

yangjunjun avatar Sep 02 '22 07:09 yangjunjun

Deploy Preview for vue-sfc-playground failed.

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

netlify[bot] avatar Sep 02 '22 07:09 netlify[bot]

See https://github.com/vuejs/core/issues/6580#issuecomment-1501485144 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 avatar Apr 10 '23 07:04 haoqunjiang