From c52f8a02475cb9baf21f7485e35c8dca68ae2b1d Mon Sep 17 00:00:00 2001 From: Jan Keromnes Date: Tue, 16 Nov 2021 10:25:23 +0000 Subject: [PATCH] [dashboard] Fix Cancel button state in Prebuild page by also updating prebuild info on instance update --- components/dashboard/src/projects/Prebuild.tsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/components/dashboard/src/projects/Prebuild.tsx b/components/dashboard/src/projects/Prebuild.tsx index a50e19a561c68f..d957de2ef765f6 100644 --- a/components/dashboard/src/projects/Prebuild.tsx +++ b/components/dashboard/src/projects/Prebuild.tsx @@ -80,8 +80,16 @@ export default function () { ) }; - const onInstanceUpdate = (instance: WorkspaceInstance) => { + const onInstanceUpdate = async (instance: WorkspaceInstance) => { setPrebuildInstance(instance); + if (!prebuild) { + return; + } + const prebuilds = await getGitpodService().server.findPrebuilds({ + projectId: prebuild.info.projectId, + prebuildId + }); + setPrebuild(prebuilds[0]); } const rerunPrebuild = async () => { @@ -132,7 +140,7 @@ export default function () { Rerun Prebuild ({prebuild.info.branch}) : (prebuild?.status === 'building' - ?