Skip to content

Commit 6f1161c

Browse files
committed
Prevent the “re-save after logout” behavior
1 parent 1d5a1f7 commit 6f1161c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

frontend/src/components/Header/Chat.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,13 @@ const Chat: React.FC<ChatDropDownProps> = ({ showChat, setShowChat }) => {
8989
}
9090
}, []);
9191

92+
9293
// Save conversation to sessionStorage when component unmounts
9394
useEffect(() => {
9495
return () => {
95-
if (currentMessages.length > 0) {
96+
// Only save if the user hasn't logged out
97+
const isLoggingOut = !localStorage.getItem("access");
98+
if (!isLoggingOut && currentMessages.length > 0) {
9699
saveConversationToStorage(currentMessages, currentResponseId);
97100
}
98101
};

0 commit comments

Comments
 (0)