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

$rootScope.user state corruption #66

Closed
booleanbetrayal opened this issue Nov 14, 2014 · 2 comments
Closed

$rootScope.user state corruption #66

booleanbetrayal opened this issue Nov 14, 2014 · 2 comments

Comments

@booleanbetrayal
Copy link
Collaborator

Hey @lynndylanhurley -

Seeing something a bit odd which doesn't make any sense immediately. I have a single-page-app (no hard page-loads ever) on which I perform the following to produce state staleness in $rootScope.user

  1. Join (Register) a new user and hit a landing page
  2. Validate $rootScope.user contains the new user information
  3. Sign out
  4. Login with a separate, pre-existing user
  5. Validate that $rootScope.user contains the old, recently-registered user information rather than the user just logged in as

The same does not appear to be happening when logging out / logging back in with existing users.

Re-assigning $rootScope.user = @user within handleValidAuth seems to fix the underlying problem, but I don't see why the same corruption isn't happening on multiple login / logouts. Admittedly, I haven't jumped into it much, as relying on $auth.user in my client code is sufficient to keep things in sync properly.

Might be sufficient to just eliminate $rootScope.user and let people manually assign that value (if needed), rather than keep it in sync with $auth.user.

@lynndylanhurley
Copy link
Owner

That's strange - $rootScope.user should be a reference to $auth.user. In other words, they should be the same object (no syncing necessary).

I'll write a test around these steps and see if I can reproduce the bug. Thx!!

@booleanbetrayal
Copy link
Collaborator Author

hey @lynndylanhurley .. let me save you some time. Looks like we were clobbering that $rootScope value elsewhere under certain circumstances. Closing this!

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

No branches or pull requests

2 participants