You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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|https://github.com/realm/realm-core/blob/6bebc40a03ca4144050bc672a6cd86c2286caa32/src/realm/object-store/sync/app.cpp#L822] 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.
The text was updated successfully, but these errors were encountered:
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 insideswitch_user
and when logging in,switch_user
[ is called before|https://github.com/realm/realm-core/blob/6bebc40a03ca4144050bc672a6cd86c2286caa32/src/realm/object-store/sync/app.cpp#L822]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 thecallback
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.
The text was updated successfully, but these errors were encountered: