Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove reset logic which cleared all slots #2353

Merged
merged 3 commits into from
Oct 31, 2023

Conversation

Mike-Heneghan
Copy link
Contributor

@Mike-Heneghan Mike-Heneghan commented Oct 30, 2023

What

  • Remove the resetAllSlots logic from updateFileListWithTags.
  • Remove initial definition of updatedFileList from updateFileListWithTags.
  • Refactor from merge(fileList) to cloneDeep(fileList)

Why

  • A bug was encountered where if a file had one tag which was then removed it would erroneously trigger the resetAllSlots which would wipe the tags applied to all files.
  • As a tag can either be added or removed one at a time it was unclear what the use case for the reset was so it was removed to resolve the bug.
  • During debugging some opportunities for refactoring were found this included:
    • Moving from single argument merge to cloneDeep as merge was not a deep clone leading us to mutate state directly.
    • Removing the initial definition of updatedFileList from the updateFileListWithTags function as the initial value was never used.

Screen recordings

Bug recording:

#2209 (comment)

Fix recording:

Screen.Recording.2023-10-30.at.15.54.57.mov

- Encountered a bug where if a file went from having one label (tag) to no labels then a validation error would appear and all tags would be lost
- Discovered that in these cases resetAllSlots was being called causing this behaviour
- Removed the reset all logic which resolved the bug
@Mike-Heneghan Mike-Heneghan self-assigned this Oct 30, 2023
- The `updatedFileList` was being defined but the value of that defintion was never being used
- Removed the definition and added repetition but hopefully leaving more readable code.
@github-actions
Copy link

github-actions bot commented Oct 30, 2023

Removed vultr server and associated DNS entries

- Found that merge with a single argument was shallow copying
- This lead to us directly updating the fileList
- Changed to `cloneDeep` as there was already precedence within the file
- As per #1811 structuredClone not yet supported in our stack
@Mike-Heneghan Mike-Heneghan requested a review from a team October 30, 2023 15:57
@Mike-Heneghan Mike-Heneghan marked this pull request as ready for review October 30, 2023 15:57
Copy link
Contributor

@DafyddLlyr DafyddLlyr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect! ✅

We can merge this to main (staging) and request PO testing there on the Trello ticket 👍

@Mike-Heneghan Mike-Heneghan merged commit 723a0e7 into main Oct 31, 2023
12 checks passed
@Mike-Heneghan Mike-Heneghan deleted the mh/upload-labelling-bug branch December 13, 2023 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants