Skip to content

Remove deleted files from open editor tabs #2386

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

Merged
merged 7 commits into from
Mar 26, 2023

Conversation

ianyong
Copy link
Member

@ianyong ianyong commented Mar 24, 2023

Description

Resolves the following issue that was raised by @zhaojj2209 in #2378:

  • If a file tab is open, the tab will remain even if the file is deleted. Note below that the /test folder/test.js tab still exists even though the file no longer exists.
    telegram-cloud-photo-size-5-6104838078012175332-y

Part of #2176.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Code quality improvements

How to test

The multiple files mode is not yet ready for production and is disabled programmatically. Enable multiple files mode for testing by changing the condition to false:

const toggleMultipleFilesModeButton = React.useMemo(() => {
// TODO: Remove this once the multiple file mode is ready for production.
if (true) {
return <></>;
}
return (
<ControlBarToggleMultipleFilesModeButton
isMultipleFilesEnabled={isMultipleFilesEnabled}
toggleMultipleFilesMode={() => dispatch(toggleMultipleFilesMode(workspaceLocation))}
/>
);
}, [dispatch, isMultipleFilesEnabled, workspaceLocation]);

Then, verify that deleting files or folders from the file system view results in the corresponding editor tabs being closed.

@ianyong ianyong requested a review from zhaojj2209 March 24, 2023 11:51
@coveralls
Copy link

Pull Request Test Coverage Report for Build 4510868611

  • 36 of 39 (92.31%) changed or added relevant lines in 5 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.1%) to 35.029%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/commons/fileSystemView/FileSystemViewFileNode.tsx 0 1 0.0%
src/commons/fileSystemView/FileSystemViewDirectoryNode.tsx 0 2 0.0%
Files with Coverage Reduction New Missed Lines %
src/commons/fileSystemView/FileSystemViewFileNode.tsx 1 2.78%
Totals Coverage Status
Change from base Build 4508399233: 0.1%
Covered Lines: 4726
Relevant Lines: 12570

💛 - Coveralls

@ianyong ianyong merged commit e0d15bd into master Mar 26, 2023
@ianyong ianyong deleted the remove-deleted-files-from-open-editor-tabs branch March 26, 2023 02:54
RichDom2185 pushed a commit to NUS-CS1101S/cadet-frontend that referenced this pull request Jul 15, 2023
* Extract out next active editor tab index logic

* Add REMOVE_EDITOR_TAB_FOR_FILE action

* Add tests for REMOVE_EDITOR_TAB_FOR_FILE action

* Remove corresponding open editor tab when deleting files if it exists

* Add REMOVE_EDITOR_TABS_FOR_DIRECTORY action

* Add tests for REMOVE_EDITOR_TABS_FOR_DIRECTORY action

* Remove corresponding open editor tabs when deleting directories
@coveralls
Copy link

coveralls commented Sep 22, 2024

Pull Request Test Coverage Report for Build 4510868611

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 36 of 39 (92.31%) changed or added relevant lines in 5 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.1%) to 35.029%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/commons/fileSystemView/FileSystemViewFileNode.tsx 0 1 0.0%
src/commons/fileSystemView/FileSystemViewDirectoryNode.tsx 0 2 0.0%
Files with Coverage Reduction New Missed Lines %
src/commons/fileSystemView/FileSystemViewFileNode.tsx 1 2.78%
Totals Coverage Status
Change from base Build 4508399233: 0.1%
Covered Lines: 4726
Relevant Lines: 12570

💛 - Coveralls

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.

3 participants