Skip to content

Commit

Permalink
fix: repeated label removed from file on change click bug
Browse files Browse the repository at this point in the history
- When the modal was rendered it was incorrectly updating the fileList as the previousTags variable was undefined.
- The update function only ever applies a tag to a single file so the second file was not being tagged.
- Set the previousTags to the last state or the initialTags on first render
- Updates are checked but an update isn't applied as the previousTags = intialTags
  • Loading branch information
Mike-Heneghan committed Nov 17, 2023
1 parent b2fc694 commit ac2895f
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ const SelectMultiple = (props: SelectMultipleProps) => {

const initialTags = getTagsForSlot(uploadedFile.id, fileList);
const [tags, setTags] = useState<string[]>(initialTags);
const previousTags = usePrevious(tags);
const previousTags = usePrevious(tags) || initialTags;
const [open, setOpen] = React.useState(false);

const handleChange = (event: SelectChangeEvent<typeof tags>) => {
Expand Down

0 comments on commit ac2895f

Please sign in to comment.