effect in "add" mode continually re-applied to actor/sheet

I have a datamodel value of type new fields.ArrayField(new fields.BooleanField(), { initial: [false], }) And I have an effect in "add" mode that adds another false to the array. Which seems to work. however, when i close and re-open the character sheet I see that the array is now 3 [false, false, false]. Other datamodal attributes eg: number don't behave this way. Am I interpretting the ArrayField incorrectly?
3 Replies
CussaMitre
CussaMitre•8mo ago
Array fields work not in the best way. You need to always send the full list back to the server, not only add new one
bluegreymouse
bluegreymouseOP•8mo ago
mmm i see. i was trying to use a form and input with name property. but ended up just managing the update myself in js
Zhell🎄
Zhell🎄•8mo ago
The value is [false]. The effect adds false to the array, and now it is [false, false]. You render the sheet. It shows [false, false] in some way. The sheet has its form submitted, which includes [false, false]. The effect adds false to the array, and now it is [false, false, false]. If you modify a property with an effect, you should disable its input on the sheet to prevent submitting the modified value. This isn't due to it being an array. If it was a number, an effect would also continuously be adding itself to the field.
Want results from more Discord servers?
Add your server