[GH-ISSUE #257] Missing details in docs on 'mutations' event use #119

Open
opened 2026-05-23 08:31:12 -06:00 by gitea-mirror · 0 comments
Owner

Originally created by @AVapps on GitHub (Jan 9, 2025).
Original GitHub issue: https://github.com/appy-one/acebase/issues/257

MutationsDataSnapshot forEach method runs its callback on mutations Array through Array.prototype.every function. Thus, if the callback does not return true it will only be run once on first mutation.

Docs should be updated to reflect this behavior.

Current example :

chatRef.on('mutations', snap => {
    snap.forEach(mutationSnap => {
        handleMutation(mutationSnap);
    });
})

Should at least include :

chatRef.on('mutations', snap => {
    snap.forEach(mutationSnap => {
        handleMutation(mutationSnap);
        return true; // Return true to continue iterating  mutations
    });
})
Originally created by @AVapps on GitHub (Jan 9, 2025). Original GitHub issue: https://github.com/appy-one/acebase/issues/257 MutationsDataSnapshot forEach method runs its callback on mutations Array through Array.prototype.every function. Thus, if the callback does not return true it will only be run once on first mutation. Docs should be updated to reflect this behavior. Current example : ``` chatRef.on('mutations', snap => { snap.forEach(mutationSnap => { handleMutation(mutationSnap); }); }) ``` Should at least include : ``` chatRef.on('mutations', snap => { snap.forEach(mutationSnap => { handleMutation(mutationSnap); return true; // Return true to continue iterating mutations }); }) ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/acebase#119
No description provided.