-
Notifications
You must be signed in to change notification settings - Fork 586
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
Key path filtered notifications in Object
and Collection
#6310
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have some suggestions. Otherwise, looks good 👍🏼
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome getting this in so it can be tried out. Left some ideas and suggestions 👍
[ | ||
EMPTY_OBJECT_CHANGESET, | ||
() => { | ||
// Updating the age to 42 will ensure the object doesn't leave the results |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Updating the age to 42 will ensure the object doesn't leave the results | |
// Updating the age will ensure the listener is not triggered by a non-specified key path. |
d7fc197
to
d3498ba
Compare
9f8c7db
to
d687e74
Compare
32a3760
to
bacd09c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
Co-authored-by: LJ <[email protected]>
Co-authored-by: LJ <[email protected]>
… union is indeed used
b46b689
to
852122c
Compare
) * Pin Listeners to throwOnReAdd * Adding key path filtering to Collection * Tests WIP * Show the entire diff when deep.equals fails * Implemented key-path notifications for RealmObject * Adding an entry to the changelog * Passing key-paths through for Dictionary * Adding dictionary tests * Adding changelog entry about the dictionary fix * Adding a note on the breaking change * Apply suggestions from code review Co-authored-by: LJ <[email protected]> * Adding string overload to Object#addListener * Adding @param doc strings * Adding an example to the changelog and doc comments. * Refactored to use a common "expectNotifications" function * Moved keyPaths before changesAndActions * Apply suggestions from code review Co-authored-by: LJ <[email protected]> * Adding a few more tests * Adding a test using wildcard (*) * Using key-path array of strings in tests again * Adding multiple listeners with different key paths to verify that the union is indeed used * Separated key-path tests into separate "it"s * Update SDK unit tests * Moved changelog entry from breaking changes to fixed * Update CHANGELOG.md * Updated doc comments * Updated readd tests * Updating a comment --------- Co-authored-by: LJ <[email protected]>
What, How & Why?
This closes #6285 by exposing an optional third argument to the
addListener
methods.This also updates Core to v13.24.0 to pull in the new APIs that got added to the spec.yml and depends on one additional change that hasn't been merged and released yet.
NOTE: Because of 30d99c0 adding a listener twice, will start throwing instead of being a no-op. We had tests for this, but it wasn't explicitly documented, so technically not a breaking change to the documented API, but it still might result in runtime errors in some consuming code-bases.
☑️ ToDos
Compatibility
label is updated or copied from previous entryCOMPATIBILITY.md
Object
,Results
andDictionary
- missing tests onList
andSet
, but they hit the same code)package.json
s (if updating internal packages)Breaking
label has been applied or is not necessary