-
Notifications
You must be signed in to change notification settings - Fork 576
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/react - Cannot create asynchronous query while in a write transaction #4306
Comments
@WenLonG12345 Strange issue. It does feel like a race condition. What would help us investigate would be a sample project that we could run that causes this issue. Can you provide that for us? |
Hi sorry for the delay. I am changing hooks approach to use the traditional way, but yet still get the same error. https://github.com/WenLonG12345/RealmRaceCondition Here is my example on implementing realm, and the error occurs when Or maybe I did a wrong approach? |
I would recommend using the hooks approach for querying your data. This will make sure the listeners are correctly persisted. You can still use your same approach for writing data. As I said in the other thread, opening
|
@WenLonG12345 I have made a PR on the repository you sent me. This is working with no errors in both Android and iOS. |
This sounds like it could be related to or a duplicate of #4375. @WenLonG12345 are you still having this problem? If so please feel free to reopen this issue with more details. |
How frequently does the bug occur?
All the time
Description
Hi, I am recently using the new hooks library
@react/realm
, but I get some error when using it with redux saga.My situation is to call API to get a list of room, insert it to realm and display in UI.
Here is my code.
Sagas is responsible to perform the insert operation, but somehow I keep getting the error on
Cannot create asynchronous query while in a write transaction
.I was wondering if it is a race condition on these hooks library?
By the way, I am still beginner in React, do correct me if I made any mistake.
Stacktrace & log output
Can you reproduce the bug?
Yes, always
Reproduction Steps
No response
Version
10.11.0
What SDK flavour are you using?
Local Database only
Are you using encryption?
No, not using encryption
Platform OS and version(s)
Android 11
Build environment
Which debugger for React Native: ..
Flipper
Cocoapods version
No response
The text was updated successfully, but these errors were encountered: