-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
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
$attrs is undefined when component has no props #6263
Comments
Out of curiosity, what problem are you facing by having an undefined edit: I'm also asking because having |
@greegus, in case you're doing something like |
I would judge this to be expected behaviour, but it's debatable. |
ping @greegus |
Just ran into this and it was definitely unexpected for me that For example, if you were writing a todo app that starts out with no todos, it would be very strange to make the list begin as For niche cases when a user wants to check if any The part that really convinces me this is a bug though, is that $attrs && Object.keys($attrs).length |
@chrisvfritz convinced me - it's a bug. |
@LinusBorg Looks like no one is working on this bug currently. May I have a pr for this? |
Sure! |
Version
2.4.2
Reproduction link
https://jsfiddle.net/50wL7mdz/50757/
Steps to reproduce
Access $attrs as object within component context, when no props were provided.
What is expected?
$attrs is an object containing unrecognized props. Therefore I would expect an empty object, when no props are specified on component tag.
What is actually happening?
$attrs is undefined
The text was updated successfully, but these errors were encountered: