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] Accounts.onLogin not fired if disabled cache and slow network #10157

goodideal opened this issue Aug 16, 2018 · 3 comments


Copy link

commented Aug 16, 2018

Using accounts-base@1.4.2.

When the network is bad and disable the cache or entering the page first time, the Accounts.onLogin was fired occasionally. But Meteor.userId() in autorun works perfectly.


This comment has been minimized.

Copy link

commented Mar 1, 2019

This issue can be reproduced in Chrome.

  1. Open dev tools
  2. Check 'Disable cache (while devtools is open)':

screen shot 2019-03-01 at 1 29 57 pm

Observe Accounts.onLogin does not fire on page refresh (only hard login).

Uncheck the box and Accounts.onLogin fires every time (both on page refresh and login).


This comment has been minimized.

Copy link

commented May 2, 2019

This still exists on build 1.8.1
I am seeing this bug on Cordova builds.

After location.reload()

This just started happening, so I suspect it is a timing bug that gets exacerbated by disabling the cache.

Anyone know of a way to work around this on Cordova builds?

@benjamn benjamn added this to the Release 1.8.2 milestone May 2, 2019


This comment has been minimized.

Copy link

commented May 3, 2019

@benjamn ,

I made some progress tracking this down.

Essentially, the livedata connection is up and running before the Accounts.onLogin callbacks can get registered. When using cache this kinda goes away (the first location.reload will display the issue until cached, which I suppose I have always assumed was a glitch 😸 ).

I am assuming that the timing of this code running is likely pretty tricky. So I propose to add another internal method to Accounts: _startupCallback(callbackId).

This function will check that the user is already logged in, if true then go ahead and schedule the execution of the callback with {type: "resume"}, because this can only really be called if a resume happens before the onLogin is called.

I have it all tested out in my config and it works well.

I will have PR up in a jiffy.

benjamn added a commit to brucejo75/meteor that referenced this issue May 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
4 participants
You can’t perform that action at this time.