A question about the documentation

In the documentation for dynamic properties, it says

Updating Classes

If we consider an example with a ui-button, you can send the following msg to the button itself:

json

msg = {
    "ui_update": {
        "class": "my-class"
    }
}

...
Note also that msg.class injection is still supported for legacy reasons, but it is recommended to use ui_update.class where possible.

Can anyone explain why it deprecates msg.class?

It was purely a consistency thing. We were introducing dynamic properties across all nodes for pretty much every property, so couldn't justify msg.label, msg.chartType, etc.

As such, we nested into msg.ui_update.<property>, and for consistency, didn't want msg.class to be the only property that didn't

To add to what Joe said: It was determined that nesting the updates in a property made it less likely to affect UI nodes by accident.

e.g. suppose we added dynamic property support for target, status, timeout to a particular UI node. New users may not be aware of these additional properties being populated in the message from some upstream nodes - so nesting all new dynamic props in ui_update helps avoid these collisions.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.