From df13d6f01abe349ac9342e1b7699f2941e4b9e2f Mon Sep 17 00:00:00 2001 From: Celia Amador Date: Wed, 4 Nov 2026 13:15:38 +0100 Subject: [PATCH] Avoid breaking the guide progress Made-with: Cursor --- .../src/components/QuickStart/QuickStart.tsx | 5 +++-- .../src/components/QuickStart/QuickStartContext.tsx | 11 ++++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/libs/ui-components/src/components/QuickStart/QuickStart.tsx b/libs/ui-components/src/components/QuickStart/QuickStart.tsx index 758e49351..3e59f5004 100644 --- a/libs/ui-components/src/components/QuickStart/QuickStart.tsx +++ b/libs/ui-components/src/components/QuickStart/QuickStart.tsx @@ -95,11 +95,12 @@ const CardStatusLabel = ({ status }: { status: PhaseCardStatus }) => { const PhaseCard = ({ card, prevPhaseId }: PhaseCardProps) => { const { t } = useTranslation(); - const { startPhase } = useQuickStart(); + const { activePhaseId, isGuideOpen, startPhase } = useQuickStart(); const { checkPermissions } = usePermissionsContext(); const PhaseIcon = PHASE_ICONS[card.icon]; const isLocked = card.status === 'locked'; + const isContinueDisabled = card.status === 'in-progress' && activePhaseId === card.id && isGuideOpen; const actionLabel = getActionLabel(t, card.status); const productName = useProductName(); @@ -162,7 +163,7 @@ const PhaseCard = ({ card, prevPhaseId }: PhaseCardProps) => { ) : ( - )} diff --git a/libs/ui-components/src/components/QuickStart/QuickStartContext.tsx b/libs/ui-components/src/components/QuickStart/QuickStartContext.tsx index dc9b3c90a..c4070441d 100644 --- a/libs/ui-components/src/components/QuickStart/QuickStartContext.tsx +++ b/libs/ui-components/src/components/QuickStart/QuickStartContext.tsx @@ -22,6 +22,7 @@ export type QuickStartPanelValue = { totalMinutes: number; completedPhases: QuickStartPhaseId[]; activePhaseId: QuickStartPhaseId | null; + isGuideOpen: boolean; activeStepIndex: number; toggleVisibility: VoidFunction; toggleCollapsed: VoidFunction; @@ -70,6 +71,7 @@ export const useQuickStart = (): QuickStartPanelValue => { totalMinutes: store.totalMinutes, completedPhases: store.completedPhases, activePhaseId: store.activePhaseId, + isGuideOpen: store.isGuideOpen, activeStepIndex: store.activeStepIndex, toggleVisibility: store.toggleVisibility, toggleCollapsed: store.toggleCollapsed, @@ -193,6 +195,12 @@ export const QuickStartProvider = ({ children, username }: QuickStartProviderPro return; } + if (activePhaseId === phaseId && phase.status !== 'complete') { + // Re-entering the active phase resets state without rerunning its guide effects. + setIsGuideMinimized(false); + return; + } + const savedIndex = persisted.phaseProgress[phaseId]?.lastStepIndex ?? 0; const stepIndex = isPhaseComplete(phaseId, persisted) ? 0 @@ -211,7 +219,7 @@ export const QuickStartProvider = ({ children, username }: QuickStartProviderPro }, })); }, - [persisted, phases, resetGuidePresentation, updatePersisted], + [activePhaseId, persisted, phases, resetGuidePresentation, updatePersisted], ); const setStepIndex = React.useCallback( @@ -278,6 +286,7 @@ export const QuickStartProvider = ({ children, username }: QuickStartProviderPro totalMinutes: totalMinutes, completedPhases: persisted.completedPhases, activePhaseId, + isGuideOpen: activePhaseId !== null && !isGuideMinimized, activeStepIndex, guidePresentation, guideActions,