fulcro

Yaw Odame 2024-11-04T17:47:11.954629Z

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?

tony.kay 2024-11-04T18:25:03.130729Z

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

Yaw Odame 2024-11-04T19:16:28.766809Z

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

tony.kay 2024-11-04T19:17:31.526249Z

no, what you see is correct

✅ 1
tony.kay 2024-11-04T19:18:03.019239Z

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

tony.kay 2024-11-04T19:18:13.145849Z

and that the child query has form config join as well

Yaw Odame 2024-11-04T20:03:26.424389Z

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"}]

tony.kay 2024-11-04T20:08:38.926769Z

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

Yaw Odame 2024-11-04T20:25:30.569019Z

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.

tony.kay 2024-11-04T20:27:32.123589Z

oh, sorry, I misread

tony.kay 2024-11-04T20:27:38.532449Z

the second IS what you should see

tony.kay 2024-11-04T20:28:03.215019Z

unless you didn’t change ownership

tony.kay 2024-11-04T20:28:14.356179Z

if it is a NEW one, the second is right

tony.kay 2024-11-04T20:28:26.529379Z

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

Yaw Odame 2024-11-04T21:06:00.011639Z

Thanks for confirming

👍 1