Skip to content

Commit

Permalink
fix: bug with file requirements not changing on delete of file (#2417)
Browse files Browse the repository at this point in the history
* fix: resolve bug where deleting a file didn't remove label

- Reinstate the `merge` which updates state directly
- This isn't best practice but does show how the bug started happening

* refactor: update the remove method to avoid direct state update

- Create a clone of fileList before removing the file
- Remove the file and update state with the setter
  • Loading branch information
Mike-Heneghan authored Nov 13, 2023
1 parent 07f57d1 commit 521e02d
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -240,11 +240,12 @@ function Component(props: Props) {
),
);
setFileUploadStatus(`${slot.file.path} was deleted`);
removeSlots(
const updatedFileList = removeSlots(
getTagsForSlot(slot.id, fileList),
slot,
fileList,
);
setFileList(updatedFileList);
}}
/>
);
Expand Down

0 comments on commit 521e02d

Please sign in to comment.