Browse Source

Fix bug where switching tasks would not reset expanded rows

Saoud Rizwan 1 year ago
parent
commit
d3d7ea44d0
1 changed files with 4 additions and 0 deletions
  1. 4 0
      webview-ui/src/components/chat/ChatView.tsx

+ 4 - 0
webview-ui/src/components/chat/ChatView.tsx

@@ -190,6 +190,10 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie
 		}
 		}
 	}, [messages.length])
 	}, [messages.length])
 
 
+	useEffect(() => {
+		setExpandedRows({})
+	}, [task?.ts])
+
 	const isStreaming = useMemo(() => {
 	const isStreaming = useMemo(() => {
 		const isLastAsk = !!modifiedMessages.at(-1)?.ask // checking clineAsk isn't enough since messages effect may be called again for a tool for example, set clineAsk to its value, and if the next message is not an ask then it doesn't reset. This is likely due to how much more often we're updating messages as compared to before, and should be resolved with optimizations as it's likely a rendering bug. but as a final guard for now, the cancel button will show if the last message is not an ask
 		const isLastAsk = !!modifiedMessages.at(-1)?.ask // checking clineAsk isn't enough since messages effect may be called again for a tool for example, set clineAsk to its value, and if the next message is not an ask then it doesn't reset. This is likely due to how much more often we're updating messages as compared to before, and should be resolved with optimizations as it's likely a rendering bug. but as a final guard for now, the cancel button will show if the last message is not an ask
 		const isToolCurrentlyAsking =
 		const isToolCurrentlyAsking =