fulcro 2024-11-04

I have a situation with a subform and extracting dirty fields. The subform edits a participant entity added to the top-level form component's pre-merge function. Should I expect the top-level form to extract all the dirty fields including subform fields?

Yes, the top-level form should give you all dirty fields make sure all the forms include the form-config-join and that the subform field is listed in the declared fields

Right. I have that setup correctly. I believe. Should I see data in the subform map values?

no, what you see is correct

✅ 1

Make sure the parent has a data link to the child?

and that the child query has form config join as well

kk. I can get the dirty fields of the participant subform for my top-level application form. fs/dirty-fields returns normalized changes as expected. Given the top-level form is connected to the subform, I assumed I would be able to follow the normalized "dirty" data from the :application/id node to the :entity.participant/id node. Console logging the dirty form data produces the following:

[[:application/id #uuid 123xyz] {}]
[[:entity.participant/id #uuid abc987] {:entity.participant/first-name "tester"}]
I was expecting to see:
[[:application/id #uuid 123xyz] {:entity/participants [[:entity.participant/id #uuid abc987]}]
[[:entity.participant/id #uuid abc987] {:entity.participant/first-name "tester"}]

Is that a question? It looks like it is working as designed?

The second code block is the expected. The first is what I get with fs/dirty-fields fn. Hmmm...The only thought I have is perhaps this is because the participant is an existing entity.

oh, sorry, I misread

the second IS what you should see

unless you didn’t change ownership

if it is a NEW one, the second is right

if it was EXISTING, then the edge didn’t change, so why should it be in the diff?

Thanks for confirming

👍 1