Skip to content

Commit

Permalink
fix: refresh source control view on exception
Browse files Browse the repository at this point in the history
close #183
  • Loading branch information
Vinzent03 committed Mar 18, 2022
1 parent 59214d8 commit c1eee7b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 18 deletions.
6 changes: 3 additions & 3 deletions src/ui/sidebar/components/fileComponent.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
}
function stage() {
manager.stage(change.path).then(() => {
manager.stage(change.path).finally(() => {
dispatchEvent(new CustomEvent("git-refresh"));
});
}
Expand All @@ -66,11 +66,11 @@
.then((shouldDiscard) => {
if (shouldDiscard === true) {
if (deleteFile) {
view.app.vault.adapter.remove(change.path).then(() => {
view.app.vault.adapter.remove(change.path).finally(() => {
dispatchEvent(new CustomEvent("git-refresh"));
});
} else {
manager.discard(change.path).then(() => {
manager.discard(change.path).finally(() => {
dispatchEvent(new CustomEvent("git-refresh"));
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/ui/sidebar/components/stagedFileComponent.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
}
function unstage() {
manager.unstage(formattedPath).then(() => {
manager.unstage(formattedPath).finally(() => {
dispatchEvent(new CustomEvent("git-refresh"));
});
}
Expand Down
19 changes: 5 additions & 14 deletions src/ui/sidebar/gitView.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@
if (commitMessage !== plugin.settings.commitMessage) {
commitMessage = "";
}
refresh();
});
}).finally(refresh);
}
addEventListener("git-refresh", (_) => {
Expand All @@ -112,30 +111,22 @@
function stageAll() {
loading = true;
plugin.gitManager.stageAll().then(() => {
refresh();
});
plugin.gitManager.stageAll().finally(refresh);
}
function unstageAll() {
loading = true;
plugin.gitManager.unstageAll().then(() => {
refresh();
});
plugin.gitManager.unstageAll().finally(refresh);
}
function push() {
loading = true;
if (ready) {
plugin.push().then((pushedFiles) => {
refresh();
});
plugin.push().finally(refresh);
}
}
function pull() {
loading = true;
plugin.pullChangesFromRemote().then(() => {
refresh();
});
plugin.pullChangesFromRemote().finally(refresh);
}
</script>

Expand Down

0 comments on commit c1eee7b

Please sign in to comment.