rxdb icon indicating copy to clipboard operation
rxdb copied to clipboard

Bugfix/issue 7371

Open calvinturbo opened this issue 3 months ago • 4 comments

This PR contains:

  • a bugfix for Firestore replication not receiving document updates when they move out of replication scope

Describe the problem you have without this PR

Check https://github.com/pubkey/rxdb/issues/7371

Todos

  • two collections test seems to be failing, not sure why
  • don't know if this is the most performant way of handling this, please check

calvinturbo avatar Oct 09 '25 22:10 calvinturbo

Built RxDB with this pull request in my application, seems to resolve issue with needing to call reSync() for updates & also fixes no-updates for documents moving outside of replication scope

calvinturbo avatar Oct 13 '25 11:10 calvinturbo

Hi @calvinturbo The changes look good to me, but it seems that this breaks the CI, please check.

pubkey avatar Oct 20 '25 11:10 pubkey

Test "two collections" fails for some reason. It returns 5 documents instead of the 10 documents added. Tried all kinds of things but didn't get it working.

Even when putting this in the test itself:

 const q = query(firestoreState.collection);
            onSnapshot(q, (snapshot: { metadata: { hasPendingWrites: any; }; empty: any; docChanges: () => any[]; }) => {
                if (snapshot.metadata.hasPendingWrites || snapshot.empty) {
                    return;
                }

                snapshot.docChanges().forEach((change) => {
                    const data = change.doc.data();
                    if (change.type === "added") {
                        console.log('new');
                        console.log(change.doc.id);
                    }
                    if (change.type === "modified") {
                        console.log('modified');
                        console.log(change.doc.id);
                    }
                    if (change.type === "removed") {
                        console.log('removed');
                        console.log(change.doc.id);
                    }
                });
            });

it still only returns 5 documents via the Firestore onSnapshot after adding the 10 documents via RxDB.

calvinturbo avatar Oct 23 '25 17:10 calvinturbo

@calvinturbo any update on this?

pubkey avatar Dec 01 '25 09:12 pubkey