-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
2 - S (<= 1 week)
-
7889
-
Not Needed
Related to HELP-61640
In Realm React (and likely other SDKs) there's odd behavior with the app change notifier and JWT profile fields, namely that the change notifier fires before the profile is filled, meaning when we re-render the UI based on this change, the user profile that is exposed to the client can still have an empty, unfilled profile.
This is because emit_change_to_subscribers() happens inside switch_user and when logging in, switch_user is called before get_profile and consequently the change notification gets emitted before the profile is retrieved (and does not get re-emitted later). This leads to i.e. a discrepancy between the callback of the login and app change listener and causes the bad behavior the help ticket is about.
The solution is to to move the call to switch_user into a lambda passed to get_profile and call the completion function afterwards, ensuring the correct order of operations.