Fixes undo button on snackbar#4149
Conversation
bjester
left a comment
There was a problem hiding this comment.
It works!
Requesting that we refactor usage of oldParent to use oldObj.parent now that we're persisting oldObj on the change event.
| this.setAndValidateLookup(position, 'position', RELATIVE_TREE_POSITIONS_LOOKUP); | ||
| this.setAndValidateIsDefined(parent, 'parent'); | ||
| this.setAndValidateIsDefined(oldParent, 'oldParent'); | ||
| this.setAndValidateIsDefined(oldObj.parent, 'oldParent'); |
There was a problem hiding this comment.
We really don't need to setAndValidateIsDefined both oldObj and oldParent since, as your change here suggests, the oldParent is accessible via oldObj. So I think we should remove oldParent and update usages of oldParent to use oldObj.parent instead.
|
The usage of |
bjester
left a comment
There was a problem hiding this comment.
Nice work! Undoing a deletion works and resource count tracking still works 👍
|
Hi @akolson while testing this I noticed that it still doesn't work if the item being deleted is the last one in the folder or the last remaining folder/resource in the channel. Video: undo.mp4Error in the console: |
|
@pcenov , Thanks! let me look into this |
|
@akolson since the deletion was the last resource in a folder, I'm guessing there might be an API call being triggered to grab the children (eventual siblings) for the folder where it should re-appear. Such async invocations do not play well within Dexie transactions. |
|
Yeah, it looks like the async/wait invocations are causing issues |

Summary
Description of the change(s) you made
This pr fixes the failure of the undo button to revert back the changes on delete a resource(s) in a channel.
Screenshots (if applicable)
Screen.Recording.2023-06-16.at.20.54.46.mov
Does this introduce any tech-debt items?
No
Reviewer guidance
How can a reviewer test these changes?
UNDObutton to undo the changes madeReferences
Fixes #4116
Comments
Contributor's Checklist
PR process:
CHANGELOGlabel been added to this PR. Note: items with this label will be added to the CHANGELOG at a later timedocslabel has been added if this introduces a change that needs to be updated in the user docs?requirements.txtfiles also included in this PRStudio-specifc:
notranslateclass been added to elements that shouldn't be translated by Google Chrome's automatic translation feature (e.g. icons, user-generated text)pages,components, andlayoutsdirectories as described in the docsTesting:
Reviewer's Checklist
This section is for reviewers to fill out.
yarnandpip)