Update to 4.4
This commit is contained in:
+20
-2
@@ -202,6 +202,14 @@ async function refreshRepositories(withLoader = true, silent = false) {
|
||||
if (selectedId && !selectedRepository()) ui.selectedRepoId = null;
|
||||
const repository = selectedRepository();
|
||||
if (repository && !repository.deploymentProfiles.some((profile) => profile.id === ui.selectedProfileId)) ui.selectedProfileId = selectedProfile(repository)?.id || null;
|
||||
if (repository) {
|
||||
const availablePaths = new Set((repository.localStatus?.files || []).map((file) => file.path));
|
||||
ui.selectedFiles = new Set([...ui.selectedFiles].filter((filePath) => availablePaths.has(filePath)));
|
||||
if (ui.selectedFile && !availablePaths.has(ui.selectedFile)) {
|
||||
ui.selectedFile = repository.localStatus?.files?.[0]?.path || null;
|
||||
ui.diff = '';
|
||||
}
|
||||
}
|
||||
if (!ui.selectedRepoId && ui.currentView === 'repository' && ui.repositories.length) selectRepository(ui.repositories[0].id, false);
|
||||
} catch (error) {
|
||||
ui.refreshError = error.message;
|
||||
@@ -655,8 +663,18 @@ async function runOperation(message, operation, successMessage, { refresh = true
|
||||
if (refresh) await refreshRepositories(false);
|
||||
return result;
|
||||
} catch (error) {
|
||||
showToast(error.code === 'PUSH_AFTER_COMMIT_FAILED' ? 'Commit created; push failed' : 'Operation failed', error.message, 'error');
|
||||
if (error.commitSha) await refreshRepositories(false, true);
|
||||
const pushAfterCommit = error.code === 'PUSH_AFTER_COMMIT_FAILED';
|
||||
showToast(pushAfterCommit ? 'Commit saved locally; push failed' : 'Operation failed', error.message, 'error');
|
||||
// Always reload the real Git state. A failed stage must keep changes visible, while a
|
||||
// failed push after a successful commit must immediately surface as an ahead branch.
|
||||
await refreshRepositories(false, true);
|
||||
if (pushAfterCommit) {
|
||||
ui.selectedFiles.clear();
|
||||
ui.selectedFile = null;
|
||||
ui.diff = '';
|
||||
ui.commitMessage = '';
|
||||
render();
|
||||
}
|
||||
return null;
|
||||
} finally { setLoading(false); }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user