Jmix version: 2.5.2
Jmix Studio Plugin Version: 2.7.1-253
IntelliJ version: IntelliJ IDEA 2025.3.1
We have a view with a fragment. In the fragment we are editing a DTO. If the DTO is saved we fire an event. This event is subscribed by the view and the fragment because there could be multiple instances that shall not display obsolete data.
If a new entity is set to the fragment it checks with dataContext.isModified(oldEntity) and saves the old entity if there are unsaved changes.
Sometimes this causes an endless saving loop.
- Fragment saves and fires the event
- View gets the event and changes the entity in the fragment to the updated entity from the event. The old entity is eviced from
dataContextand freshly merged. - Fragment gets the event and changes the entity again. Due to some magic
dataContext.isModified(oldEntity)evaluates totrueand the fragment saves the old entity again and starts an endless loop.
I don’t understand why dataContext says that the entity is modified in this case.
Do you have any idea how to debug this? How would you avoid the possibility of an endless loop in this case?