Clear stale git diff selection

This commit is contained in:
Federico Jaramillo Martinez
2026-05-08 10:06:37 +02:00
parent 831c32863e
commit a98ccf20f9
+7 -1
View File
@@ -19,7 +19,13 @@ export class GitController {
const status = await api.gitStatus(project.id, workspace.id); const status = await api.gitStatus(project.id, workspace.id);
this.setState({ gitStatus: status, gitStale: false, error: "" }); this.setState({ gitStatus: status, gitStale: false, error: "" });
const selectedDiffPath = this.getState().selectedDiffPath; const selectedDiffPath = this.getState().selectedDiffPath;
if (selectedDiffPath !== undefined && status.files.some((file) => file.path === selectedDiffPath)) await this.refreshDiff(selectedDiffPath); if (selectedDiffPath !== undefined) {
if (status.files.some((file) => file.path === selectedDiffPath)) await this.refreshDiff(selectedDiffPath);
else {
this.setState({ selectedDiffPath: undefined, selectedDiff: undefined });
this.updateUrl();
}
}
} catch (error) { } catch (error) {
this.setState({ error: String(error) }); this.setState({ error: String(error) });
} }