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
One of the biggest parts of work to componentise existing code, or to create new components, is to link together all the config updating and propagation up & down, and respond to config change events, and pass that down to each of the individual child components.
This process could be simplified if we introduced a modular way of propagating configurations, and linking sub-configurations. We could also simplify the handling of more specific types at type boundaries (such as plugin config / input config) by doing the type checking in a single place, and just linking using unknown to reduce the need for type coercion.
It would need to:
accept applyConfig and
allow for adding children, example:
constchildConfig=c.addChild(// Get current valuecurrent=>current.children[id],// Update current value(current,update)=>({
...current,children: {
...current.children,[id]: update(current.children[id])}),// Optional: delete current child (required for `.delete()`(current)=>{constchildren={...current.children};deletechildren[id];return{ ...current, children};});
allow for "updating" config with an updater .update(current => { /* */ }).
allow for "deleting" the config .delete().
automatically skip applying config when nothing has changed (so we don't need this logic in each component).
Have event listeners for delete and changed.
Then usage would just be to initialize sub-components with one of these in the constructor.
The text was updated successfully, but these errors were encountered:
One of the biggest parts of work to componentise existing code, or to create new components, is to link together all the config updating and propagation up & down, and respond to config change events, and pass that down to each of the individual child components.
This process could be simplified if we introduced a modular way of propagating configurations, and linking sub-configurations. We could also simplify the handling of more specific types at type boundaries (such as plugin config / input config) by doing the type checking in a single place, and just linking using
unknown
to reduce the need for type coercion.It would need to:
accept
applyConfig
andallow for adding children, example:
allow for "updating" config with an updater
.update(current => { /* */ })
.allow for "deleting" the config
.delete()
.automatically skip applying config when nothing has changed (so we don't need this logic in each component).
Have event listeners for
delete
andchanged
.Then usage would just be to initialize sub-components with one of these in the constructor.
The text was updated successfully, but these errors were encountered: