fix: Prevent template value from overriding user input on tab switch (#5369)

* 🐛 (newChatView.tsx): fix issue where chat value was not being cleared when tab is hidden

* 🔧 (newChatView.tsx): refactor setting chat value to handle additional condition for better logic clarity
This commit is contained in:
Cristhian Zanforlin Lousa 2024-12-30 10:40:01 -03:00 committed by GitHub
commit 86b3aefe89
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -98,7 +98,7 @@ export default function ChatView({
return new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime();
});
if (messages.length === 0 && !lockChat && chatInputNode) {
if (messages.length === 0 && !lockChat && chatInputNode && isTabHidden) {
setChatValueStore(
chatInputNode.data.node.template["input_value"].value ?? "",
);