Fork me on GitHub
#fulcro
<
2023-01-14
>
Eva O01:01:35

In the RAD form :event/attribute-changed gets the cardinality and type from the event-data but those are never passed into input-changed!

tony.kay03:01:54

The general assumption of many calls is that having either the attribute or the qualified key of the attribute (which should enable lookup in your model) is sufficient for you to determine what you want to know. I’m not exactly sure which thing you’re referring to: the trigger or some UI thing?

Eva O18:01:46

input-changed! triggers the attribute-changed event like this:

(uism/trigger!! form-instance asm-id :event/attribute-changed
      {::attr/qualified-key k
       :form-ident          form-ident
       :form-key            (comp/class->registry-key (comp/react-type form-instance))
       :old-value           old-value
       :value               value})
Note that the cardinality and the type are not passed into the event-data. Then :event/attribute-changed calls it like this:
{:keys       [old-value form-key value form-ident]
                  ::attr/keys [cardinality type qualified-key]} event-data
It is expecting the cardinality and the type to be passed into the event-data. Those values will always be nil.

Eva O02:01:50

Also the docs for use-state says it returns a vector, but it actually returns an array