fix: use index for deleting asset [ZEND-5025] #7932
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Purpose
This PR to get the
dam-app-base
ready to support React 18 introduced some changes to thedeleteItem
login in theSortableComponent
. These changes caused issues with deleting, where when clicking on an item in the list to delete, the first item instead got deleted.Approach
The
key
was being used to splice the item from the list, but this turned out to be the URL of the asset, so this was getting passed asNaN
and then removing the first item in the list. This PR updates thedeleteItem
logic to instead use index instead of key.Testing steps
I tested this locally using
npm pack
to test the changes to thedam-app-base
within the Bynder app.Breaking Changes
Dependencies and/or References
Deployment
After updating the
dam-app-base
we will open a PR for the Bynder app to bump the package version.