From 0f72c54dfb99cd1f7af76ec533b2af7a46b092c2 Mon Sep 17 00:00:00 2001 From: michael Date: Thu, 4 Dec 2025 08:51:37 -0600 Subject: [PATCH] Fix tab not switching to Review after discussion guide generation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The useEffect that reverts to Setup tab on cancellation was incorrectly firing after successful generation. Added check for discussionGuide to only revert when generation was actually cancelled (no guide exists). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- src/components/FocusGroupModerator.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/FocusGroupModerator.tsx b/src/components/FocusGroupModerator.tsx index e4592389..101e0746 100644 --- a/src/components/FocusGroupModerator.tsx +++ b/src/components/FocusGroupModerator.tsx @@ -1023,14 +1023,14 @@ export default function FocusGroupModerator({ draftToEdit, onDraftSaved, preSele guideGenerationControls.resetGeneration(); }; - // Switch to Setup tab when discussion guide generation is cancelled + // Switch to Setup tab when discussion guide generation is cancelled (not completed successfully) useEffect(() => { - if (!guideGenerationState.isGenerating && !guideGenerationState.isCancelling && - guideGenerationState.taskId === null && activeTab === 'review') { - // This indicates cancellation completed - switch back to setup + if (!guideGenerationState.isGenerating && !guideGenerationState.isCancelling && + guideGenerationState.taskId === null && activeTab === 'review' && !discussionGuide) { + // Only revert to setup if no guide was generated (i.e., cancellation, not success) setActiveTab('setup'); } - }, [guideGenerationState.isGenerating, guideGenerationState.isCancelling, guideGenerationState.taskId, activeTab]); + }, [guideGenerationState.isGenerating, guideGenerationState.isCancelling, guideGenerationState.taskId, activeTab, discussionGuide]); async function onSubmit(values: z.infer) { try {