-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
Restore child components configured as true
#2424
Conversation
lgtm |
The major changes around this were still in 4.x, so I'm surprised this works in 4.12 and not 5.x. I think I felt this wasn't needed anymore after moving to children arrays (#1599 is the closest PR I can find). Still seems like since you can just use an empty object that it'd be nice to deprecate this instead, but I'm fine either way if you have a good reason to keep it. |
I'm gonna close this as |
Alright, I'm reopening this now that I understand the whole situation better. An empty object does work, but it doesn't really feel intuitive to me - especially when Additionally, I want to raise (re-raise?) the issue that having |
Previously, child components could be configured using `true`, `false`, or an object. Support for `true` appears to have been lost in the transition to 5.0. This restores that capability.
374a580
to
693df1c
Compare
Works for me. I think
Originally
Then #1070 and #1093 happened and we added the option to use an array, specifically to control ordering. We didn't immediately switch all children objects to arrays because that would have been a pretty big breaking change and also arrays didn't allow you to pass options to children. Then #1599 happened and we can add options to children defined with an array. I believe it should work for deeper children too.
This does not help if you have two children of the same type that need different options, but I've yet to see a case of that, and if you need that you can rebuild the array. I don't think we should remove the object option just yet but if we want to mark it as deprecated I'm ok with that. I think the array version is the right way going forward. Anyone else want to weigh in? |
Deprecate the option-object but keep it around for 5.x sounds like the right path to me. |
@heff Thanks a ton for the historical clarification here! I don't have any strong opinions here, but I do prefer the array approach because it allows better control of final structure/ordering. I'll take it upon myself to document the component |
Ok cool. I guess this one is good to pull in though, yeah? |
Somewhat related, can we allow users to add in a reference to a component directly in the array and initialize it as needed? :) |
@gkatsev not sure I follow completely. Are you just saying allow for already-initialized components in the array? Or can you give an example? |
Basically. let AConstructorForVjsToInitialize = function() {
this.color = blue;
};
let someButtonThing = new Button();
// ...
children: ['foo', someButtonThing, AConstructorForVjsToInitialize, 'baz'] This should also apply for the techOrder array :) Regardless, it definitely should not hold up this PR. |
Seems like this one has gotten signed-off but I'll throw in my "LGTM" as well. |
@gkatsev re: someButtonThing may already work. If not I don't see why it couldn't be added, though also options couldn't be passed to it from the parent if it's already initialized. AConstructorForVjsToInitialize, if we're talking about non-Components, would be difficult since the child init process expects a handful of component functions to be there. |
Previously, child components could be configured using
true
,false
, or an object. Support fortrue
appears to have been lost in the transition to 5.0. This restores that capability.