fix: old folder persists in sidebar after drag-and-drop move#63
Open
chirag-bruno wants to merge 1 commit intousebruno:mainfrom
Open
fix: old folder persists in sidebar after drag-and-drop move#63chirag-bruno wants to merge 1 commit intousebruno:mainfrom
chirag-bruno wants to merge 1 commit intousebruno:mainfrom
Conversation
VS Code's file watcher only watches *.bru/*.yml files, not directories. When a folder is moved via drag-and-drop, the watcher fires unlink events for the files inside but not for the directory itself, leaving the old empty folder visible in the sidebar. After removePath completes in the move-item handler, broadcast an unlinkDir event for the source directory so the Redux store removes it from the collection tree.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
unlinkDirevent after directory move so the old folder is removed from the sidebarProblem
When dragging a folder into another folder, the folder appeared in the new location but the old folder remained visible in the sidebar. The move couldn't be "reverted" because the stale folder entry persisted.
Root Cause
VS Code's
createFileSystemWatcheronly watches file patterns (**/*.bru/**/*.yml), not directory deletions. WhenremovePathdeletes a folder during a move, the watcher firesunlinkevents for the.brufiles inside but not for the directory itself. The Redux store never received anunlinkDirevent, so the empty folder node stayed in the collection tree.Solution
After
removePathcompletes in therenderer:move-itemhandler, check if the source was a directory and broadcast anunlinkDirevent to all webviews. The existingcollectionUnlinkDirectoryEventreducer handles the removal from the Redux store.Test plan
JIRA: https://usebruno.atlassian.net/browse/VSCODE-46