-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Updates DataSet and DataView remove event payload #2189
Updates DataSet and DataView remove event payload #2189
Conversation
…jects that were removed in addition to the the ids.
|
@ZacBrownBand Thanks! Looks complete. Could you maybe provide a simple example that demonstrates how to use this!? That would be great. |
|
A simple example would be if you wanted to know how long something was in a dataset for. The item in the dataset could have a To accomplish this now, you would have to maintain a hashmap of the ids and times items were added, so when you get the remove event with the id you can look up the time. This was inspired by an application I am working that uses vis for data management. We have an issue were we have internal and external ids since we manage data from multiple sources, this leads to use needing more than just the id in special cases. By having the full object that was removed it is much easier to do entity resolution and ensure other things are updated accordingly. |
|
@ZacBrownBand I see. I guess you need a kind of special case to use this. But why not! Thanks! |
|
I wrote unit tests in my application, I'm happy to add one in here! |
We don't have any unit tests. But if you want to start feel free to provide a pull request ;-) |
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.
Thanks!
|
Sadly this introduced an error in DataView.refresh in line 120. I'll fix it. |
fixes DataView.refresh bug introduced with #2189
|
@mojoaxel Sorry about that, thanks for catching it. I didn't realize there was |
| item = this._remove(ids[i]); | ||
| if (item) { | ||
| itemId = item[this._fieldId]; | ||
| if (itemId) { |
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 brings in some old bugs. Like I want to remove {id: 0, from: 4, to: 5} from DataSet edges.
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.
@P1erce Can you please create an issue so we don't forget this! If you want you also could provide a simple fix :-)
The
removeevent that is triggered in DataView and DataSet only includes the ids of the items that were removed, and since the items are no longer available, it is hard to tell what items were removed.This pr would add an
oldItemsproperty to the object that is sent with theremoveevent. This is supplementary to theitemscontaining the ids to maintain reverse compatibility.This effects
ds.clear()dv.setData()or when the DataView is createdAlso updates the documentation for
datasetCallback section.