rxdb icon indicating copy to clipboard operation
rxdb copied to clipboard

Firestore removed events do not get processed(?)

Open calvinturbo opened this issue 3 months ago • 6 comments

Hi,

I am using RxDB with Firestore replication. I also have a premium license.

I am using replication for the Firestore collection 'shipments' with where filters. where('status', 'in', [ShipmentStatusEnum.PENDING, ShipmentStatusEnum.RETRIEVED, ShipmentStatusEnum.DELIVERED, ShipmentStatusEnum.ONROUTE, ShipmentStatusEnum.PLANNEDFORROUTE])

Therefore, only shipments with above statutes get replicated. In my application, you can modify the status of one or multiple shipments at the same time. If you change the status to a status not listed above via Firestore directly, the shipments statutes do not change in the application. If you modify the shipments via RxDB directly, they will change in the clients browser, but not on other clients.

Example: User A changes shipment 1 and 2 to status 'cancelled'. They change in their browser, but the status remains the same in User B's browser, because they don't process the event coming from Firestore.

https://firebase.google.com/docs/firestore/query-data/listen#view_changes_between_snapshots shows an example how to correctly process these changes

If a document moves out of the replication scope because it no longer matches the filters, a 'removed' event is received by Firestore client. I have verified this myself with my application.

Image

RxDB should correctly process 'removed' events and .remove() documents that are no longer in the Firestore replication scope.

calvinturbo avatar Sep 18 '25 14:09 calvinturbo

Can you make a PR with a test case that reproduces your problem? You can start with this template.

pubkey avatar Sep 21 '25 10:09 pubkey

This issue has been automatically marked as stale because it has not had recent activity. It will be closed soon. Please update it or it may be closed to keep our repository organized. The best way is to add some more information or make a pull request with a test case. Also you might get help in fixing it at the RxDB Community Chat If you know you will continue working on this, just write any message to the issue (like "ping") to remove the stale tag.

stale[bot] avatar Oct 01 '25 18:10 stale[bot]

Ping, pretty busy right now, but will write the test soon

calvinturbo avatar Oct 01 '25 18:10 calvinturbo

This issue has been automatically marked as stale because it has not had recent activity. It will be closed soon. Please update it or it may be closed to keep our repository organized. The best way is to add some more information or make a pull request with a test case. Also you might get help in fixing it at the RxDB Community Chat If you know you will continue working on this, just write any message to the issue (like "ping") to remove the stale tag.

stale[bot] avatar Oct 08 '25 21:10 stale[bot]

Created pull request, added test case to firestore-replication.test file https://github.com/pubkey/rxdb/pull/7445

calvinturbo avatar Oct 08 '25 22:10 calvinturbo

This issue has been automatically marked as stale because it has not had recent activity. It will be closed soon. Please update it or it may be closed to keep our repository organized. The best way is to add some more information or make a pull request with a test case. Also you might get help in fixing it at the RxDB Community Chat If you know you will continue working on this, just write any message to the issue (like "ping") to remove the stale tag.

stale[bot] avatar Oct 15 '25 23:10 stale[bot]