You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to find a way to reduce unnecessary array patches and I'm curious if there is a solution for this scenario. I have items that contain an array of objects like this:
Currently when I diff changes to this type of structure I end up with add and remove operations for entire "things" objects even when only a single property in the object changes (e.g. things[0].foo changes but the other properties remain constant).
I understand why this happens but is there a way to provide a hint to jiff so that it could match array objects on their "id" value? Or is that something that a feature that you would consider including?
The text was updated successfully, but these errors were encountered:
Providing a custom hash function to the diff method is what you are looking for. In this example the object's id is returned, if it exists (and truthy), otherwise the default hash function is used (taken from jiff's code).
I'm trying to find a way to reduce unnecessary array patches and I'm curious if there is a solution for this scenario. I have items that contain an array of objects like this:
Currently when I diff changes to this type of structure I end up with add and remove operations for entire "things" objects even when only a single property in the object changes (e.g. things[0].foo changes but the other properties remain constant).
I understand why this happens but is there a way to provide a hint to jiff so that it could match array objects on their "id" value? Or is that something that a feature that you would consider including?
The text was updated successfully, but these errors were encountered: