From 741a06abae642d63c0b90c474a33eabad61ff8ab Mon Sep 17 00:00:00 2001
From: log
Date: Wed, 24 Jun 2026 14:23:46 +0800
Subject: [PATCH] fix(ui): clear regenerating status when stage stops running

---
 video-claw/video-claw/frontend/components/stages/ReferenceStage.tsx |    7 +++++++
 video-claw/video-claw/frontend/components/stages/CharacterStage.tsx |    7 +++++++
 video-claw/video-claw/frontend/components/stages/VideoStage.tsx     |    7 +++++++
 3 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/video-claw/video-claw/frontend/components/stages/CharacterStage.tsx b/video-claw/video-claw/frontend/components/stages/CharacterStage.tsx
index 428bdbd..e1c69d7 100644
--- a/video-claw/video-claw/frontend/components/stages/CharacterStage.tsx
+++ b/video-claw/video-claw/frontend/components/stages/CharacterStage.tsx
@@ -366,6 +366,13 @@
     });
   }, [allAssets, regeneratingIds.size]);
 
+  useEffect(() => {
+    if (state.status !== 'running') {
+      setRegeneratingIds(new Set());
+      regenerationStartCounts.current = {};
+    }
+  }, [state.status]);
+
   const hasChars = characters.length > 0;
   const hasSets = settingsData.length > 0;
 
diff --git a/video-claw/video-claw/frontend/components/stages/ReferenceStage.tsx b/video-claw/video-claw/frontend/components/stages/ReferenceStage.tsx
index 8b41d39..16409f5 100644
--- a/video-claw/video-claw/frontend/components/stages/ReferenceStage.tsx
+++ b/video-claw/video-claw/frontend/components/stages/ReferenceStage.tsx
@@ -427,6 +427,13 @@
     });
   }, [scenes, regeneratingIds.size]);
 
+  useEffect(() => {
+    if (state.status !== 'running') {
+      setRegeneratingIds(new Set());
+      regenerationStartCounts.current = {};
+    }
+  }, [state.status]);
+
   const hasScenes = scenes.length > 0;
 
   // 保存单个提示词到后端 JSON
diff --git a/video-claw/video-claw/frontend/components/stages/VideoStage.tsx b/video-claw/video-claw/frontend/components/stages/VideoStage.tsx
index f8ac0a5..8dfb536 100644
--- a/video-claw/video-claw/frontend/components/stages/VideoStage.tsx
+++ b/video-claw/video-claw/frontend/components/stages/VideoStage.tsx
@@ -417,6 +417,13 @@
     // eslint-disable-next-line react-hooks/exhaustive-deps
   }, [clips]);
 
+  useEffect(() => {
+    if (state.status !== 'running') {
+      setRegeneratingIds(new Set());
+      regenerationStartCounts.current = {};
+    }
+  }, [state.status]);
+
   const hasClips = clips.length > 0;
   const canEdit = state.status === 'waiting' || state.status === 'completed';
 

--
Gitblit v1.8.0