From 6e514f2521d7785b861c1506cf5d567591499d41 Mon Sep 17 00:00:00 2001 From: Michael Cartner <32543275+michaelcartner@users.noreply.github.com> Date: Tue, 6 Feb 2024 16:03:04 +0100 Subject: [PATCH] fix: version control panel - show correct state when a push is rejected (#23) --- .../VersionControlPanel/components/GitStatusButton.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/noodl-editor/src/editor/src/views/panels/VersionControlPanel/components/GitStatusButton.tsx b/packages/noodl-editor/src/editor/src/views/panels/VersionControlPanel/components/GitStatusButton.tsx index d90ecfb..9276a1a 100644 --- a/packages/noodl-editor/src/editor/src/views/panels/VersionControlPanel/components/GitStatusButton.tsx +++ b/packages/noodl-editor/src/editor/src/views/panels/VersionControlPanel/components/GitStatusButton.tsx @@ -324,6 +324,11 @@ export function GitStatusButton({ openGitSettingsPopout }: GitStatusButtonProps) }); } else { ToastLayer.showError('Failed to push. ' + error); + + // If the error is a rejected push, we need to fetch again to get the latest state where we can pull and rebase + if (error?.toString().includes('rejected')) { + await fetchRemote(); + } } return;