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

Fix target of mutations events on wildcard paths #230

Merged
merged 4 commits into from
Jul 17, 2023

Conversation

appy-one
Copy link
Owner

If mutations or notify_mutations are set on a path containing wildcards (* or named variables), the mutation's target is not being set correctly.

Example:

db.ref('users/*/books').on('mutations', (mutations) => {
  mutations.forEach(snap => {
    const m = snap.val();
    const target = m.target;
    // if mutation is on `users/user1/books/book1/title`, target contains ['ooks', 'book1', 'title']
    // but target should be ['book1', 'title']
  });
});

TODO: snap.ref.path probably contains users/*/books, but should be users/user1/books in above example. Check this, fix it if true.

@appy-one appy-one added the bug Something isn't working label May 30, 2023
@appy-one appy-one self-assigned this May 30, 2023
@appy-one appy-one merged commit a8c5bdd into master Jul 17, 2023
1 check passed
@appy-one appy-one deleted the fix/mutations-events-on-wildcard-paths branch July 17, 2023 10:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant