Skip to content

Commit 0d12cdf

Browse files
taidaiifacebook-github-bot
authored andcommitted
changedfile: skip inapplicable actions for submodule changes
Summary: Disable partial selection and openFile() for submodule changes. Diff view is temporarily disabled until it's properly supported. Currently `vscode.diff` attempts to open files which caused errors for uncommitted submodule chagnes. Plan to fix it as the next step. Reviewed By: evangrayk Differential Revision: D83270098 fbshipit-source-id: b016d145069900c05a8992dc9b36f99993e563a8
1 parent 926345c commit 0d12cdf

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

addons/isl/src/ChangedFile.tsx

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import type {ReactNode} from 'react';
99
import type {Comparison} from 'shared/Comparison';
1010
import type {Place, UIChangedFile, VisualChangedFileStatus} from './UncommittedChanges';
11+
import {ChangedFileMode} from './UncommittedChanges';
1112
import type {UseUncommittedSelection} from './partialSelection';
1213
import type {ChangedFileStatus, GeneratedStatus} from './types';
1314

@@ -123,6 +124,9 @@ export function File({
123124
.join('\n\n');
124125

125126
const openFile = () => {
127+
if (file.type === ChangedFileMode.Submodule) {
128+
return;
129+
}
126130
if (file.visualStatus === 'U') {
127131
const tool = readAtom(externalMergeToolAtom);
128132
if (tool != null) {
@@ -181,9 +185,9 @@ export function File({
181185
</span>
182186
{comparison != null && <FileActions file={file} comparison={comparison} place={place} />}
183187
</div>
184-
{place === 'main' && selection?.isExpanded(file.path) && (
185-
<MaybePartialSelection file={file} />
186-
)}
188+
{place === 'main' &&
189+
selection?.isExpanded(file.path) &&
190+
file.type !== ChangedFileMode.Submodule && <MaybePartialSelection file={file} />}
187191
</>
188192
);
189193
}
@@ -211,7 +215,12 @@ function FileActions({
211215

212216
const actions: Array<React.ReactNode> = [];
213217

214-
if (platform.openDiff != null && !conflictStatuses.has(file.status)) {
218+
if (
219+
platform.openDiff != null &&
220+
!conflictStatuses.has(file.status) &&
221+
// Disable for now until vscode.diff no longer attempts to open paths as files for uncommitted submodule changes
222+
file.type !== ChangedFileMode.Submodule
223+
) {
215224
actions.push(
216225
<Tooltip title={t('Open diff view')} key="open-diff-view" delayMs={1000}>
217226
<Button
@@ -418,7 +427,7 @@ function FileActions({
418427
}
419428
}
420429

421-
if (place === 'main' && conflicts == null) {
430+
if (place === 'main' && conflicts == null && file.type !== ChangedFileMode.Submodule) {
422431
actions.push(<PartialSelectionAction file={file} key="partial-selection" />);
423432
}
424433
}

0 commit comments

Comments
 (0)