hoist-react icon indicating copy to clipboard operation
hoist-react copied to clipboard

Store handling of structural changes

Open haynesjm42 opened this issue 3 years ago • 1 comments

Currently if you want to make a structural change to the records in a Store you need to use the updateData() method to first remove a record from its existing parent in 1 transaction, and then subsequently re-add the record to the new parent in another transaction. We also don't support changing parents in the modifyRecords() method so changing the structure of the store is always going to "commit" that record and the structural change cannot be reverted.

Seems like we could support a move in our RecordSet transactions and add some support to the Store updateData() and modifyRecords() apis to handle moving records around in the hierarchy. This likely requires considering the parent in any record equality checking and tracking a "committed" parent on the record itself to be consistent with the record data - either committedData or committedParent being different than data or parent would indicate that the Record (and Store) has been modified and needs to be committed.

Note that this change is in support of a client app need for drag-and-drop hierarchy changes in an inline-editing enabled grid which needs to make use of the Store/Record add/modify/remove apis.

haynesjm42 avatar Mar 17 '21 18:03 haynesjm42