-
-
Notifications
You must be signed in to change notification settings - Fork 516
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
Allow .current to return CustomUser #680
Conversation
If we do `Parse.Object.registerSubclass('CustomUser', CustomUser);`, parse still serializes the current user in local storage with `className="_User"`. As such, in subsequent loading of the app, the deserialization process will know nothing of the CustomUser class and `CustomUser.current()` will just return a `Parse.User`. Thus we lose access to all the cool custom methods. Changing the registration to `Parse.Object.registerSubclass('_User', CustomUser)` fixes that.
thank you! |
ugh. I didn't fully understand now that you explain it. revert? |
I would hold off on the revert. I traced the sdk code for .current() for about an hour and saw that it's littered with the hardcoded Also, iirc during my trace, there are times when user processing work is delegated to CoreManager and the I feel this is a good stop gap solution to help people get their own projects moving even though it's not ideal. I recommend we leave this in place until @dplewis or someone else has a full solution implemented. And for what it's worth, a complete solution should also cover the various login providers. |
CustomUser here is simple but a more complex subclass could break your SDK. There is an open issue in JSSDK that shows this. I’ll look into current, fromJSON should return the subclass. I’ll write a test case |
@taivo I just wrote a test case and CustomUser.current() works. parse-community/Parse-SDK-JS#978 Can you let me know if any changes can replicate your issue? |
@dplewis is there a way to test the effect of reloading a page? From what I can see, the object |
@taivo Yes there is |
If we do
Parse.Object.registerSubclass('CustomUser', CustomUser);
, parse still serializes the current user in local storage withclassName="_User"
. As such, in subsequent loading of the app, the deserialization process will know nothing of the CustomUser class andCustomUser.current()
will just return aParse.User
. Thus we lose access to all the cool custom methods. Changing the registration toParse.Object.registerSubclass('_User', CustomUser)
fixes that.