Skip to content
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

Realm.login() will not run again after refreshing React Native app #3236

Closed
matt2legit opened this issue Sep 18, 2020 · 3 comments
Closed

Realm.login() will not run again after refreshing React Native app #3236

matt2legit opened this issue Sep 18, 2020 · 3 comments
Assignees

Comments

@matt2legit
Copy link

matt2legit commented Sep 18, 2020

Goals

Be able to successfully call Realm.login() again after refreshing app.

Expected Results

Login should run and return the user information like the first time the app loads

Actual Results

Nothing happens, no errors shown in the console. Realm logs don't show the request is being made.

When I fire up the React Native Debugger, I did see an error about Realm.Credentials.function(payload); not being able to be created. I believe some of the functionality for function auth is missing in the lib/browser/credentials.js and lib/browser/rpc.js. We are using function auth, however, I received the same behavior of the original issue using anonymous and other auth types.

Steps to Reproduce

Launch app from Xcode in simulator or on iOS device.

Run Login (works beautifully).
Refresh the react native bundle from the package server.
Try to login again (nothing happens)

Version of Realm and Tooling

  • Realm JS SDK Version: 10.0.0-beta.12
  • Node or React Native: React Native 0.62.2
  • Client OS & Version: iOS
  • Which debugger for React Native: Chrome
@neopit
Copy link

neopit commented Sep 18, 2020

I have the same issue.
I have to kill the app and relogin

@RealmBot
Copy link
Collaborator

➤ Chris Bush commented:

Encountered this myself. Some investigation revealed that (on iOS at least) the RunLoopScheduler is stale because its m_runloop is still pointing to the original thread, whereas the JS executor is actually running on a different thread after an app reload. This causes the scheduler to never be able to schedule requests, so the requests to log in are never heard from again. Please DM me for more details.

@blagoev
Copy link
Contributor

blagoev commented Oct 13, 2020

this is fixed in #3340

@blagoev blagoev closed this as completed Oct 13, 2020
RedBeard0531 added a commit that referenced this issue Jan 15, 2021
The problem with the fix in #3340 was that it was causing the
EventLoopDispatcher to be constructed on the sync thread rather than on the JS
thread, which is required. This alternative fix initializes it on the JS
thread, but ensures it is re-initialized when RN apps are reloaded.
kneth added a commit that referenced this issue Jan 15, 2021
* Revert "recreate EventLoopDispatcher in NetworkTransport on hot reload in RN (#3340)"

This reverts commit 4c4e497.

* Alternative fix for #3236 that avoids causing #3503

The problem with the fix in #3340 was that it was causing the
EventLoopDispatcher to be constructed on the sync thread rather than on the JS
thread, which is required. This alternative fix initializes it on the JS
thread, but ensures it is re-initialized when RN apps are reloaded.

Co-authored-by: Kenneth Geisshirt <[email protected]>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants