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

Collection Change Listener stops listening until next event emits and then proceeds to stop listening #4708

Closed
NqCompiler opened this issue Jul 6, 2022 · 6 comments
Labels

Comments

@NqCompiler
Copy link

NqCompiler commented Jul 6, 2022

How frequently does the bug occur?

Sometimes

Description

Our application starts initializing realm when mounting the main screen.
It starts listening to ~5 different collections.
Initially everything seems to be working fine.
However, after for example, refreshing/reloading the app (debug mode), only the initial callbacks are called for the collection listeners but they don't react to any changes.
If I make emit any event (a realm.write transaction or net-info) the change listeners are reacting again but proceed to stop listening.

If I call the initialization of realm two times - directly after mount & then couple of seconds later again (closing the previously initialized realm instance) - the problem occures less often.
I tried different devices and with mobiles on better hardware the problem occurs more often.
This happens also in PRODUCTION.
Maybe it has something to do with react-native itself, but maybe you can lead me to the root of the problem as I experience this bug only when using realm.

Stacktrace & log output

No response

Can you reproduce the bug?

Yes, sometimes

Reproduction Steps

No response

Version

10.20.0-beta.3, 10.20.0-beta.5

What SDK flavour are you using?

Atlas App Services (auth, functions, etc.)

Are you using encryption?

No, not using encryption

Platform OS and version(s)

ANDROID

Build environment

"react-native": "0.67.4"
"realm": "^10.20.0-beta.5"

Cocoapods version

No response

@NqCompiler NqCompiler changed the title Collection Change Listener stops listening until next realm.write transaction and then proceeds to stop listening Collection Change Listener stops listening until next event emits and then proceeds to stop listening Jul 6, 2022
@NqCompiler NqCompiler reopened this Jul 6, 2022
@kneth
Copy link
Contributor

kneth commented Jul 8, 2022

I believe it is a duplicate (or a variant) of #2655

@sync-by-unito sync-by-unito bot added the Waiting-For-Reporter Waiting for more information from the reporter before we can proceed label Jul 8, 2022
@NqCompiler
Copy link
Author

I have come across this issue as well but there are some differences:

  • touching the UI does not trigger an update
  • setting state within the callback function does not work as temporary solution because the callback is not triggered at all

but it is also possible it might be a variant...
I will leave it open and when #2655 is fixed I'll check if it works for me

@github-actions github-actions bot added Needs-Attention Reporter has responded. Review comment. and removed Waiting-For-Reporter Waiting for more information from the reporter before we can proceed labels Jul 11, 2022
@takameyer
Copy link
Contributor

@NqCompiler I see you mentioned using debug mode. Is that with the chrome debugger? If you run this in "non-debug" mode, does it still have an issue?

@sync-by-unito sync-by-unito bot added Waiting-For-Reporter Waiting for more information from the reporter before we can proceed and removed Needs-Attention Reporter has responded. Review comment. labels Jul 11, 2022
@NqCompiler
Copy link
Author

I can't use the chrome debugger (Error: This version of Realm JS doesn't support the legacy Chrome Debugger. Please use Flipper instead. see #4364 )

So I assume I am already running in on "non-debug" mode (?), if not can I toggle it via the RN "In-App Developer Menu"?
please note: this happens in production

@github-actions github-actions bot added Needs-Attention Reporter has responded. Review comment. and removed Waiting-For-Reporter Waiting for more information from the reporter before we can proceed labels Jul 11, 2022
@takameyer
Copy link
Contributor

@NqCompiler That is correct that the chrome debugger is not supported, I just wanted to rule that out. Without seeing some sort of sample code (ideally something that reproduces the issue), it is difficult for me to determine what is going wrong. Can you possibly provide a reproduction repo or some sample code I can use to invoke this issue?

Also I would like to recommend using our package @realm/react for React Native development. This library handles all the notification handling and re-rendering for you, and generally simplifies the usage of realm.

@sync-by-unito sync-by-unito bot added Reproduction-Required Waiting-For-Reporter Waiting for more information from the reporter before we can proceed labels Jul 11, 2022
@NqCompiler
Copy link
Author

I managed to rewrite our code and the error is now #2655

For your information:
After implementing @realm/react, the error still appeared.
Our application uses two realm instances but not at the same time.
First realm instance starts initially and after unmounting the screen, it is closed. Then the second instance is opened.
We rewrote this code by using one realm instance and voila we arrived at #2655 which is much easier to handle or accept as a bug.

Thanks for the help

@github-actions github-actions bot removed the Waiting-For-Reporter Waiting for more information from the reporter before we can proceed label Jul 22, 2022
@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.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants