You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The trouble is that child-component-name is defined inside the JS file for the child component -- the tagName. It creates a hard dependency between the two classes. It is possible for the parent component to overwrite that component name by passing in the tagName to the child component constructor -- but that's cumbersome and not very convenient. In practice, the parent component just ends up using whatever the child component defined as their tagName.
If the child component gets refactored at a later date and gets a new tagName, then it would break any other component that uses it.
As a possible solution I think we should remove tagName from the Nimbly component configs and allow components to specify the name of a child component when it's being registered.
So the registerChild method would become something like this:
Today, to register child components, we must do something like this:
The template of the parent component might then look something like this:
The trouble is that
child-component-name
is defined inside the JS file for the child component -- thetagName
. It creates a hard dependency between the two classes. It is possible for the parent component to overwrite that component name by passing in thetagName
to the child component constructor -- but that's cumbersome and not very convenient. In practice, the parent component just ends up using whatever the child component defined as theirtagName
.If the child component gets refactored at a later date and gets a new
tagName
, then it would break any other component that uses it.As a possible solution I think we should remove
tagName
from the Nimbly component configs and allow components to specify the name of a child component when it's being registered.So the
registerChild
method would become something like this:this.registerChild(childComponent, "component-name");
This will get a bit more complicated for registering child components for repeatable sections, will need to discuss with the team.
The text was updated successfully, but these errors were encountered: