Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Meteor.user() is sometimes undefined on resuming the app from background #148

Closed
bratelefant opened this issue Feb 12, 2024 · 5 comments · Fixed by #149
Closed

Meteor.user() is sometimes undefined on resuming the app from background #148

bratelefant opened this issue Feb 12, 2024 · 5 comments · Fixed by #149
Labels
bug Something isn't working

Comments

@bratelefant
Copy link
Collaborator

On iOS I can observe that in my production / staging env, sometimes I get an undefined Meteor.user() after the app is resume from background. This happened using NetInfo or no NetInfo.

Steps to reproduce the behavior:

  1. Publish Expo App eg. via TestFlight
  2. Let the app suspend to background (eg. not open for several hours) while being logged in
  3. resume your app and notice, that requests do not have logged in user

Expected behavior
User should resume the session

Screenshots
n/A

Device (please complete the following information):
iOS, iPhone 12, 15, iPad 8th gen, iOS 17, recent MeteorRN builds

@bratelefant bratelefant added the bug Something isn't working label Feb 12, 2024
@bratelefant
Copy link
Collaborator Author

I'll try to come up with a minimal reproduction of the issue. However this seems hard to reproduce.

There seems to be no null-checks on the method call of User._loginWithToken, so a null token value will be saved in Data._tokenIdSaved in any case; maybe this is could be related?

@jankapunkt
Copy link
Member

Thanks @bratelefant I will try to get to the bottom of this

@jankapunkt
Copy link
Member

By the way I found that logginIn and loggingOut events are not correct:

  _startLoggingIn() {
    this._reactiveDict.set('_loggingIn', true);
    Data.notify('loggingIn');
  },
  _startLoggingOut() {
    User._isLoggingOut = true;
    Data.notify('loggingOut');
  },
  _endLoggingIn() {
    this._reactiveDict.set('_loggingIn', false);
    Data.notify('loggingIn');
  },
  _endLoggingOut() {
    User._isLoggingOut = false;
    Data.notify('loggingOut');
  },

The _endLoggingIn should emit loggedInt and _endLoggingOut should emit loggedOut

@molimauro
Copy link

still facing this issue.. @bratelefant is this working on our side now? Ty!

@bratelefant
Copy link
Collaborator Author

I'm currently quite happy with my branch fix/handle-token-login-callback
No issues with null users here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants