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

On resume User is temporarily null after loggingIn is set to false #58

Closed
ToyboxZach opened this issue Mar 29, 2021 · 2 comments
Closed
Labels

Comments

@ToyboxZach
Copy link
Contributor

When reconnecting to the server the order of events is

Meteor.status().connected == true
Meteor.loggingIn() == true
Meteor.loggingIn() == false
Meteor.user() gets set

When I would expect

Meteor.status().connected == true
Meteor.loggingIn() == true
Meteor.user() gets set
Meteor.loggingIn() == false

This inconsistency makes it hard to get the loading states to look right since there is a time that the user is not there but it is not loggingIn and connected.

To work around I need to check if Meteor._userIdSaved is set to see if it's going to load it still, but it is not ideal looking at a private variable.

@TheRealNate
Copy link
Collaborator

Hey @ToyboxZach. Thanks for submitting this bug. I've looked at the login flow and confirmed that the issue exists. I will try and get a fix out soon.

@github-actions
Copy link

github-actions bot commented Dec 2, 2022

Closing this issue due to no activity. Feel free to reopen.

jankapunkt added a commit that referenced this issue Mar 17, 2023
…y better

Merge pull request #111 from ToyboxZach/Merge

Restructure how we handle the Tracker, instead of a global listen to any change make the listens happen on specific queries and collections. Also fixes some bugs where we would generate way too many instances of subscriptions.

This also fixes the log in flow so the series of loggingIn -> LoggedIN is consistent and doesn't allow the package to ever auto log you out as that should be handled by the owning app just like in base meteor.

Every time you register a callback it gets added to a generic "changed" callback, that means that every single callback needs to be called on every single change to a collection which causes a huge hold up on the UI thread.

To make it even worst the subscriptions don't get cleaned up when you resubscribe so every time a "withTracker" or "useTracker" was called you would get stacked subscriptions. This then would lead to 100 plus subscriptions for a single component after some time which leads to bigger and bigger slow downs.

My PR separates that out as much as possible and makes sure that you only have as many subscriptions as you actually need. It is a pretty hefty change and I don't personally use and local collections in my app so those are going to be pretty poorly tested, but if other people want to take my change as a jumping off point I think its a pretty good point for server only subscriptions.

This also fixes up weirdness with the logging in and order of events where you would have an invalid user state or it would force you to logout because of bad internet

Likely fixes these erorrs:
#75
#58

and maybe
#79
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants