Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
AVapps opened this issue Jan 9, 2025 · 0 comments
Open

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

AVapps opened this issue Jan 9, 2025 · 0 comments

Comments

@AVapps
Copy link

AVapps commented Jan 9, 2025

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 up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant