parse-community / Parse-SDK-JS

The JavaScript SDK for Parse Platform
https://parseplatform.org
Apache License 2.0
1.33k stars 597 forks source link

linkWith() on React Native using currentUser() #1296

Closed eberperetto closed 3 years ago

eberperetto commented 3 years ago

New Issue Checklist

Issue Description

When using linkWith() on React Native using Google as a provider, it calls currentUser() on the background, which causes the following error:

Error: Cannot call currentUser() when using a platform with an async storage system. Call currentUserAsync() instead.

Steps to reproduce

Call linkWith() on a new Parse.User object and pass Google as the provider along with the correct authData from Google Signin. I've set this project here with the complete setup.

Actual Outcome

Error message:

Error: Cannot call currentUser() when using a platform with an async storage system. Call currentUserAsync() instead.

Expected Outcome

The linked Parse.User object.

Environment

React Native v0.63.4

Server

Database

Client

Logs

Error: Cannot call currentUser() when using a platform with an async storage system. Call currentUserAsync() instead.
currentUser@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:111793:24
value@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:111502:38
value@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:111280:40
http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:111393:31
tryCallOne@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:3475:16
http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:3576:27
_callTimer@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:30664:17
_callImmediatesPass@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:30703:17
callImmediates@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:30920:33
__callImmediates@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:2769:35
http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:2555:34
__guard@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:2752:15
flushedQueue@http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false:2554:21
flushedQueue@[native code]
callFunctionReturnFlushedQueue@[native code]
dplewis commented 3 years ago

I see this has been an issue for a while now. I think we can use currentUserAsync() in as many places as we can. Also I think a new method isCurrentAsync() would be useful for react-native users.

eberperetto commented 3 years ago

Thanks for this PR, it's now working as expected! Any idea on when will this be officially released? I'm using this library in a public user guide and need to only use official releases. Sorry for commenting here, not sure where to do this.

pastean commented 3 years ago

Has this been released?