Closed Flamesson closed 2 years ago
@aiden-izumi Hi!
Fragments in your example have different instances of the loader and the same instance of InstanceContainer. When the screen loads the second fragment it sets to the container loader from the second fragment. In the BeforeShow event, the first fragment tries to load data by a loader that is not bound with the container, so that is why an item is null.
Try to set <loader id="userDl" provided="true"/>
in both fragments.
@aiden-izumi Hi!
Fragments in your example have different instances of the loader and the same instance of InstanceContainer. When the screen loads the second fragment it sets to the container loader from the second fragment. In the BeforeShow event, the first fragment tries to load data by a loader that is not bound with the container, so that is why an item is null.
Try to set
<loader id="userDl" provided="true"/>
in both fragments.
@Flaurite You're right, thanks. It fixes the problem
When we have two fragments in a screen with the same provided InstanceContainer one of them will have loaded entity, another won't
Sample project: https://github.com/aiden-izumi/jmix-fragments-data-container-problem
How to reproduce: 1) Open screen editor for a user (f.e. default generated admin) 2) Check log for notes. It will be written there is the InstanceContainer entity (User in this case) null in specific fragment or not
Sample console output: sample console output.txt
In the attached file User is null in first fragment and is not null in the second fragment. Between log entries is a very short period of time