Skip to content

Commit c266fb3

Browse files
BoscoCHWfcollonval
andauthored
close diff window when changes to file are discarded (#1132)
* close diff window when changes to file are discarded * add callback to close diff window * Update src/commandsAndMenu.tsx Remove console log Co-authored-by: Frédéric Collonval <[email protected]> Co-authored-by: Frédéric Collonval <[email protected]>
1 parent bd0913e commit c266fb3

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/commandsAndMenu.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,15 @@ export function addCommands(
606606
})`;
607607
modelIsLoading.reject(msg);
608608
}
609+
610+
gitModel.statusChanged.connect((_, status) => {
611+
const targetFile = status.files.find(
612+
fileStatus => model.filename === fileStatus.from
613+
);
614+
if (!targetFile || targetFile.status === 'unmodified') {
615+
mainAreaItem.dispose();
616+
}
617+
});
609618
}
610619

611620
return mainAreaItem;

0 commit comments

Comments
 (0)