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
[RDART-968] Add support for keypath filtering on object #1601
Conversation
* main: (31 commits) Add vNext Changelog header (#1594) [Release 2.0.0] (#1593) Cleanup the changelog for 2.0.0 (#1592) Wrong test for local development (#1591) Add vNext Changelog header (#1589) [Release 2.0.0-beta.2] (#1588) Update melos to 5.2.0 (#1587) RDART-977: Hierarchical logger (#1574) Fix release workflow (#1582) RDART-978: Add support RealmValue.fromJson (#1581) Fix oversight in install command Add vNext Changelog header (#1579) [Release 2.0.0-beta.1] (#1577) RDART-976: Fix install command (#1576) Update build instructions and switching Flutter/Dart versions (#1571) gitignore release folder Remove incorrectly committed files Cleanup changelog, bring back melos publishing (#1573) Add vNext Changelog header (#1572) [Release 2.0.0-alpha.5] (#1570) ...
@nirinchev @nielsenko It's still a little rough, but I thought it would be a good idea if you could give me some initial feedback, so I know I'm going in the right direction |
}); | ||
|
||
// TODO Need to decide what we expect here.... | ||
test('mappedProperty', () async { |
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.
This test at the moment passes, but we should decide what kind of behaviour we want to have with mapped properties.
At the moment we need to pass the "managed" name when we subscribe, but we get the mapped name in changes
return getChangesFor<T>(object, null); | ||
} | ||
|
||
//TODO we need to decide if we want to have keyPaths be nullable here of we force developers to use getChanges in that case |
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.
What do you think?
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.
As a user, you will not be using these, but the property changes
and the method changesFor
, so I don't think it matter that much.
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 think I put this comment in the wrong place, but I was actually referring to changesFor
, that at the moment can accept a null argument. Should we keep it like this? Ot should we make the keypath argument non-nullable and force developers to use changes
for the default notifications?
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 think we should allow null
as well, so changes
and changesFor(null)
is essentially the same.
This is more or less reviewable. I'm still trying to understand why the backlink tests are failing (it seems that no backlink notifications are raised). |
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.
So far so good 👍 . I'll take another look once you set it ready-for-review.
For other reviewers. The double creation of the keypathNative
array is a small blemish we already discussed and will address in a later PR
[List<String>? keyPaths, int? classKey]) { | ||
return using((Arena arena) { | ||
Pointer<realm_key_path_array> kpNative = nullptr; | ||
|
||
if (keyPaths != null && classKey != null) { | ||
final length = keyPaths.length; | ||
final keypathsNative = arena<Pointer<Char>>(length); | ||
|
||
for (int i = 0; i < length; i++) { | ||
keypathsNative[i] = keyPaths[i].toCharPtr(arena); | ||
} | ||
|
||
kpNative = _realmLib.invokeGetPointer(() => _realmLib.realm_create_key_path_array(object.realm.handle._pointer, classKey, length, keypathsNative)); | ||
} |
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.
LGTM
Perhaps get the classKey
from the realmObject
instead of passing it as an argument?
return getChangesFor<T>(object, null); | ||
} | ||
|
||
//TODO we need to decide if we want to have keyPaths be nullable here of we force developers to use getChanges in that case |
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.
As a user, you will not be using these, but the property changes
and the method changesFor
, so I don't think it matter that much.
* main: RDART-996: Don't serialize backlinks (#1617) Update README.md (#1608) RDART-983: Refactor how we open dynamic library to give better error message (#1614) RDART-991: Rename Key enum (#1613) RDART-992: Handle Identifer expression as well (#1612) Add workflow_dispatch for development Common setup script (#1610) RDART-992: Const initializer evaluation is too simple (#1607) # Conflicts: # CHANGELOG.md
@nielsenko fixed the comments on the PR, added documentation and changelog entry, fixed the generated code tests |
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.
LGTM
* main: New documentation URL (#1621) RDART-980: Add tests for collections in `Mixed` with synced realms (#1585) RDART-987: Schema migration support follow-up (#1622) Update changelog for collections in mixed and sync RDART-987: Schema migration support (#1586) # Conflicts: # packages/realm_dart/test/realm_value_test.realm.dart
Pull Request Test Coverage Report for Build 8703959258Details
💛 - Coveralls |
This PR adds the
changeFor([List<String>? keyPaths]
method to the generated realm classes to support keypath filtering on object notificationsTODO