Skip to content

Commit 68485ef

Browse files
author
David Hasani
committed
only show plan when ready
1 parent 803bb47 commit 68485ef

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

packages/core/src/codewhisperer/service/transformByQ/transformApiHandler.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -684,6 +684,7 @@ export async function getTransformationSteps(jobId: string, profile: RegionProfi
684684

685685
export async function pollTransformationJob(jobId: string, validStates: string[], profile: RegionProfile | undefined) {
686686
let status: string = ''
687+
let isPlanComplete = false
687688
while (true) {
688689
throwIfCancelled()
689690
try {
@@ -723,9 +724,14 @@ export async function pollTransformationJob(jobId: string, validStates: string[]
723724

724725
if (
725726
CodeWhispererConstants.validStatesForPlanGenerated.includes(status) &&
726-
transformByQState.getTransformationType() === TransformationType.LANGUAGE_UPGRADE
727+
transformByQState.getTransformationType() === TransformationType.LANGUAGE_UPGRADE &&
728+
!isPlanComplete
727729
) {
728-
await openTransformationPlan(jobId, profile)
730+
const plan = await openTransformationPlan(jobId, profile)
731+
if (plan?.toLowerCase().includes('dependency changes')) {
732+
// final plan is complete; show to user
733+
isPlanComplete = true
734+
}
729735
}
730736

731737
if (validStates.includes(status)) {
@@ -790,6 +796,7 @@ async function openTransformationPlan(jobId: string, profile?: RegionProfile) {
790796
transformByQState.setPlanFilePath(planFilePath)
791797
await setContext('gumby.isPlanAvailable', true)
792798
}
799+
return plan
793800
}
794801

795802
async function attemptLocalBuild() {

0 commit comments

Comments
 (0)