-
Notifications
You must be signed in to change notification settings - Fork 575
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
Halfbaked implementation of access to deleted object keys #5081
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.
If I understand this correctly, there will now be an additional deletedObjects
array sent to the change listener, which contains all the objectKeys which have been removed from the current collection.
I think this would solve the current problem, but it's a bit, as you put it, halfbaked. I think it would be a cleaner interface if the arguments to the listener were:
(listenerCollection, changesByIndex, changesByObjectKey)
The changesByObjectKey would then adhere to the same structure as changesByIndex (with records: insertions, newModifications, deletions). This would increase flexibility of the listeners.
Another possibility would be a breaking change to changes
which had a different structure:
{
changes:{
byIndex: {
insertions: [...], // array of indexes
newModifications: [...],
deletions: [...]
},
byObjectKey: {
insertions: [...], //array of objectKeys
newModifications: [...],
deletions: [...]
},
//deprecated
insertions: [...],
newModifications: [...],
deletions: [...]
}
I am not really sure what the interface to the application is. My assumption was that this was more or less defined by the cache. So you should only transfer information to the |
We are currently using the |
How would I go about merging this with the most recent version of realm-js? I'm not good with C++, but I desperately need access to the deleted object keys (or the deleted objects). It seems like implementing this would solve my problem, so I would like to work on it but don't know where to start. I'm a bit lost as to where the CallbackWrapper is now. It seems that there needs to be changes to |
@leon-wbr Actually we found out that this was not needed after all. Unfortunately I can't remember the details. |
That is unfortunate, because it would help solve #783, which is my problem. I'd like to implement a change listener like onDelete for every time an object is deleted, similar to what is possible in Ruby on Rails' ORM. It seems this is one of the only limited factors. |
What, How & Why?
This is an attempt to show how the issue explained in realm-core#5220 could be solved. My knowledge on how things are handled in
cachedCollectio.ts
is zero, so please bare with me.To be used as a basis for further discussion.
This closes # ???
☑️ ToDos
Compatibility
label is updated or copied from previous entryCOMPATIBILITY.md
package.json
s (if updating internal packages)Breaking
label has been applied or is not necessaryIf this PR adds or changes public API's: