Meteor-Community-Packages / Meteor-Community-Packages/ground-db

Half logged out state when grounding Meteor.users

Open
#163 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
569
Forks
77
PR merge metrics
No merged PRs in 30d

Description

Hi!
This problem is a bit elusive, so I'll try to bring enough information so we could perhaps figure it out:

In my app all users sign in using accounts-facebook.
It's vital for my app to keep working and have the user's data when offline, so I'm grounding Meteor.users:

```
if (Meteor.isClient) {
Meteor.startup(() => {
Ground.Collection(Meteor.users);
});
}
```

Sometimes, however, when connected to the server, I see that while everything seems to be working ok - the user "seems" to be logged out (i.e., gives a "sign in with facebook" button). I can't quite figure out exactly what causes this and when this happens - but I think it's usually after the user disconnects from the server and reconnects.

If I exit the app and reenters it just becomes connected and signed in again (all becomes OK).
I also have some callback registered on "Hooks.onLoggedOut" which never gets called - so the system doesn't know that the user has logged out (because he really didn't log out).

It's really hard to debug since I can't reproduce this problem manually. It just sometimes happens.
My guess is that it has to do with some conflict in the grounded Meteor.users. Does that sound reasonable? Any idea how I can go about trying to handle this?

Thanks! Please tell me if you need more info...

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the disconnect-and-reconnect flow while Ground.Collection(Meteor.users) is enabled, then compare the grounded user data with Meteor's login state and the login-buttons display. Done means reconnecting no longer leaves the app appearing logged out, or the cause and a reliable reproduction are documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.