Hello. I've wrestled with this for four days without success so I could use some help. The code below simply adds a new record to an Entity ('Activity'). This code works fine and does what it is supposed to on add and delete. However, the entity now has a relationship from itself (Activity) to another Entity (Player). Each Activity has 1 player. The view is loaded on init with the currently active player and that record is stored in a state variable. Now when the viewcontext is saved, the record stored in the state variable (a Player record is invalidated). This physically is seen as the players name disappears from the screen after the context save. This ONLY happens when the relationship field is maintained - if I don't do that, the activity record saves fine and the state is maintained. I cant figure this out and could use help.
Code
Code