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

ParseReact breaks Parse.User.logOut() #161

Open
lrettig opened this issue Jan 19, 2016 · 8 comments
Open

ParseReact breaks Parse.User.logOut() #161

lrettig opened this issue Jan 19, 2016 · 8 comments

Comments

@lrettig
Copy link

lrettig commented Jan 19, 2016

ParseReact (0.5.0) patches Parse.User.logOut() (Parse 1.6.14) like so:

logOut: function() {
  var promise = oldLogOut();
  LocalSubscriptions.currentUser.update();
  return promise;
},

Unfortunately, this breaks logging out since LocalSubscriptions.currentUser.update() runs before oldLogOut() has finished and its promise has resolved. It calls Parse.User.currentAsync() -- which returns the still logged-in user -- and then on line 97 it calls setCurrentUser(current) which undoes the log out and logs the user right back in.

This it's impossible to log out the Parse user using Parse.User.logOut() with ParseReact installed. Help!

Important note: this bug only appears to manifest when A+ compliance is enabled on Parse Promises by calling Parse.Promise.enableAPlusCompliant()--apparently because of this difference:

All then callbacks are executed asynchronously.

(cf. http://stackoverflow.com/a/31223217/2397068)

However, enabling A+ compliance should not break this, and besides the Parse team intends to migrate all promises to A+ compliance (cf. parse-community/Parse-SDK-JS#57) so I think this does need to be fixed.

@thewizster
Copy link

+1

ParseReact is seriously in question now with Parse shutting down. Plus, this repo has many issues and no attention for months now. I would recommend migrating away from ParseReact. React is a great platform but unfortunately Parse integration with React is no longer a viable reality.

https://github.com/angular/angular
http://backbonejs.org/#View

@lrettig
Copy link
Author

lrettig commented Feb 8, 2016

Shortly after encountering this issue, which was sort of the final straw for me, I moved away from Parse-React and haven't looked back. It wasn't difficult. Instead of using the Parse-React style local subscriptions, I just created a flux-style Store per data type and have each of my React components subscribe to them. Problem solved.

The other thing that was killing me about Parse-React was that I had two completely different data types floating around in my app: Parse Objects and whatever object type Parse-React subscriptions produced.

@thewizster
Copy link

Thanks for the feedback! That sounds like a viable solution for me as well. @lrettig

@tristanbbq
Copy link

@lrettig: same here, it's unfortunate, but I'm moving away from parse-react as well.

@thewizster: with parse-server, Parse integration in React is still viable!

@kkgelu
Copy link

kkgelu commented Feb 20, 2016

Oops, same here, we are doing React Native. Can repro on some devices, users just can't sign out at all.

Large part of the app already built with ParseReact, some workarounds would be appreciated before I rewrite the parts....

@lrettig
Copy link
Author

lrettig commented Feb 20, 2016

@kkgelu you could try disabling A+ compliance on parse promises. That's an option but it's enabled by default now. Note that I haven't tested this.

@kkgelu
Copy link

kkgelu commented Feb 23, 2016

@lrettig yeah, don't brother. I started making my flux stores, I am also having the other issue of Parse objects vs. ParseReact-ed objects, frustrating...

@juanruizcasas
Copy link

bien

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

No branches or pull requests

5 participants