When things work correctly for me I can see that the log file is slightly different. Here is the relevant snippet that works (equivalent to lines 134 to 157 in the previously attached log file):
[DEBUG] | org.granite.tide.data.EntityManager | mergeCollection: org.granite.tide.collections::PersistentCollection [uk.co.prodia.habittracker.persistence.entity::HtDay:298 (NoteConversationPM.CONVERSATION_EDIT_DAY_NOTE-1)] previous org.granite.tide.collections::PersistentCollection []
[DEBUG] | org.granite.tide.data.EntityManager | mergeEntity: uk.co.prodia.habittracker.persistence.entity::HtDay:298 (NoteConversationPM.CONVERSATION_EDIT_DAY_NOTE-1) previous null
[DEBUG] | org.granite.tide.data.EntityManager | mergeCollection: mx.collections::ArrayCollection [] previous null
[DEBUG] | org.granite.tide.data.EntityManager | mergeCollection result: mx.collections::ArrayCollection []
[DEBUG] | org.granite.tide.data.EntityManager | mergeCollection: mx.collections::ArrayCollection [] previous null
[DEBUG] | org.granite.tide.data.EntityManager | mergeCollection result: mx.collections::ArrayCollection []
[DEBUG] | org.granite.tide.data.EntityManager | mergeEntity: uk.co.prodia.habittracker.persistence.entity::HtNote:255 (NoteConversationPM.CONVERSATION_EDIT_DAY_NOTE-1) previous null
[DEBUG] | org.granite.tide.data.EntityManager | mergeEntity result: uk.co.prodia.habittracker.persistence.entity::HtNote:255 (global)
[DEBUG] | org.granite.tide.data.EntityManager | mergeEntity result: uk.co.prodia.habittracker.persistence.entity::HtDay:298 (global)[INFO] | uk.co.prodia.habittracker.pm.impl.component.tracker.dateBox.DateBoxPM | Entered function onHtDaysChange[DEBUG] | uk.co.prodia.habittracker.pm.impl.component.tracker.dateBox.DateBoxPM | event.kind [add]
[DEBUG] | uk.co.prodia.habittracker.pm.impl.component.tracker.dateBox.DateBoxPM | htDay [298] [8D7DA2C3-7F6D-777D-692C-A3AF028AEC19] has [1] htNotes
In this case Granite merges the collection AND the entities beforecalling the
onHtDaysChange event handler.
In the ones that fail Granite merges the collection, then the event handler is called and then Granite merges the entities. This means that the event handler does not get the whole of the merge. The problem is I don't know what I am doing to cause this behaviour.