rxdb: Subscriber breaks with react-native and async storage
Case
I was just developing an app using rxdb and react-native, when the time came to update a record on the database, suddenly a subscription on a collection broke
Issue
triggering an update on document (via atomicSet or any other update operation) breaks the query response on other parts of the app
Reproducible example:
I’ve created a repo with the issue:
https://github.com/ospfranco/rxdb-rn-bug
to reproduce:
- clone and run the app:
yarn,yarn ios - click on
add random nodea couple of times, so you have some elements - click on one of the ids on the list
- click on
randomly update selected node, it will do an atomic update and all of the sudden the list of elements will be cleared, and only the selected node will remain
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 24 (13 by maintainers)
Commits related to this issue
- ADD(docs) warning for #2286 — committed to pubkey/rxdb by pubkey 4 years ago
Just FYI, I got the sqlite2 adapter working by simply modifying the podspec, the bug is not present there, I would suggest removing the old adapter documentation since it is abandoned anyways, I submitted a PR that includes macOS support:
https://github.com/craftzdog/react-native-sqlite-2/pull/82
@pubkey I have updated the original repo to expo, hopefully that will save you some time.
I copied&pasted the code for debug, nothing out of the ordinary is logged:
But you can try it yourself more easily now I hope