Skip to content

Missing details in docs on 'mutations' event use #257

@AVapps

Description

@AVapps

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
    });
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions