[PR #230] [MERGED] Fix target of mutations events on wildcard paths #179

Closed
opened 2026-05-23 08:32:39 -06:00 by gitea-mirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/appy-one/acebase/pull/230
Author: @appy-one
Created: 5/30/2023
Status: Merged
Merged: 7/17/2023
Merged by: @appy-one

Base: masterHead: fix/mutations-events-on-wildcard-paths


📝 Commits (4)

  • 8d657d9 Fix mutations events on wildcard paths
  • 0dc9180 fix * mutations events fired on higher paths
  • 2652212 Add unit test
  • ad2ae13 Add more tests

📊 Changes

2 files changed (+120 additions, -31 deletions)

View changed files

📝 src/storage/index.ts (+63 -31)
📝 src/test/events.spec.ts (+57 -0)

📄 Description

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.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/appy-one/acebase/pull/230 **Author:** [@appy-one](https://github.com/appy-one) **Created:** 5/30/2023 **Status:** ✅ Merged **Merged:** 7/17/2023 **Merged by:** [@appy-one](https://github.com/appy-one) **Base:** `master` ← **Head:** `fix/mutations-events-on-wildcard-paths` --- ### 📝 Commits (4) - [`8d657d9`](https://github.com/appy-one/acebase/commit/8d657d9ebf561c57d8b27ac338be85f1b677169d) Fix mutations events on wildcard paths - [`0dc9180`](https://github.com/appy-one/acebase/commit/0dc9180458c949e3f69a1bf19cb0ff530e691e72) fix * mutations events fired on higher paths - [`2652212`](https://github.com/appy-one/acebase/commit/265221289f85a97e55a38f8e9f254578ab867d99) Add unit test - [`ad2ae13`](https://github.com/appy-one/acebase/commit/ad2ae130398988ddca696485ab59c51f1c37ad57) Add more tests ### 📊 Changes **2 files changed** (+120 additions, -31 deletions) <details> <summary>View changed files</summary> 📝 `src/storage/index.ts` (+63 -31) 📝 `src/test/events.spec.ts` (+57 -0) </details> ### 📄 Description 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: ```js 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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
gitea-mirror 2026-05-23 08:32:39 -06:00
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#179
No description provided.