Skip to content
This repository was archived by the owner on Jan 26, 2021. It is now read-only.

Fixing the Logout/currentUser race condition. #179

Merged
merged 1 commit into from
May 3, 2017

Conversation

MonirAbuHilal
Copy link
Contributor

This code change fixes a race condition in the overriden Parse.User.logOut() method.

The logOut() method is supposed to reset the current user to null but the code path is not waiting for the oldLogOut() promise result to update the currentUser state in the local subscriptions module (LocalSubscriptions.js) which causes the LocalSubscription.currentUser.update() method to call the setCurrentUser(...) with the stale user object.

Example

Parse.User.logOut()
          .then(() => Parse.User.currentAsync())
          .then((user) => { console.log("Current User", user); });

The JS code snippet above is supposed to log "null" as the value of the user parameter, but it's logging the old stale user object all the time.

@ghost ghost added the CLA Signed label Jul 17, 2016
@MonirAbuHilal
Copy link
Contributor Author

Fixes: #161

@TonyTangAndroid
Copy link

When this pull request will be merged?

Copy link

@danielcampo danielcampo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can confirm this update fixed the issue for me.

React (15.4.1)
Parse (1.9.2)
ParseReact (0.5.2)

@acinader acinader merged commit 2765261 into parse-community:master May 3, 2017
@acinader acinader mentioned this pull request May 3, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants