Skip to content

[Bug] Document deletion is not synced to offline client after reconnection (Data inconsistency) #88

@asher-syncsoft

Description

@asher-syncsoft

Description:
I am encountering a synchronization issue with deleted documents when one device is offline.

Scenario 1 (Online - Working): When Device A and Device B are both online with the Replicator active, deleting a document on Device A immediately deletes it on Device B. This works as expected.

Scenario 2 (Offline - Failing):

Both Device A and Device B have the same document.

Device B goes offline (App closed/killed).

I delete the document on Device A.

The deletion is synced to the server (checked on Couchbase Capella, the document is correctly deleted/marked as tombstone).

Device B comes online (App opened, Replicator starts).

Result: Device B still retrieves the deleted document via query. It seems the deletion event (tombstone) is not being pulled or processed correctly by Device B upon reconnection.

Steps to Reproduce:

  1. Initialize cbl-reactnative on Device A and Device B. Connect both to the same Capella bucket.

  2. Wait for all documents to sync to Device A and B.

  3. Kill the app on Device B (simulate offline/inactive state).

  4. Delete doc_1 on Device A.

  5. Verify on Couchbase Capella dashboard that doc_1 is deleted.

  6. Open the app on Device B. Wait for the Replicator to finish connecting.

  7. Run a query on Device B to fetch doc_1.

Observed: doc_1 is still returned in the query results on Device B.

Expected: doc_1 should be removed from Device B's local database after the Replicator pulls the changes.

Environment Info:
Library Version: cbl-reactnative 0.6.3

React Native Version: 0.74.5

Platform: (iOS 18.3 / Simulator)

Server: Couchbase Capella

Replicator Config:

Type: PushAndPull

Continuous: true

Method use to delete document
await airportCollection.deleteDocument(document);

Source code:
DemoCBApp.zip

Video demo
https://drive.google.com/file/d/19ZHIl7wwbIugwfBSdsz5lghmjFLRCy9W/view?usp=sharing

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions