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.
This code change fixes a race condition in the overriden Parse.User.logOut() method.
The
logOut()
method is supposed to reset the current user tonull
but the code path is not waiting for theoldLogOut()
promise result to update thecurrentUser
state in the local subscriptions module (LocalSubscriptions.js
) which causes theLocalSubscription.currentUser.update()
method to call thesetCurrentUser(...)
with the stale user object.Example
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.