Skip to content

Commit

Permalink
Fix logout issue (#666)
Browse files Browse the repository at this point in the history
* set messages and avatar url to null on logout

* Fixed linting issues

* Remove unnecessary import
  • Loading branch information
abirc8010 authored Nov 11, 2024
1 parent afa6b81 commit 75f7760
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/react/src/views/ChatHeader/ChatHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,9 @@ const ChatHeader = ({
const dispatchToastMessage = useToastBarDispatch();
const getMessagesAndRoles = useFetchChatData(showRoles);
const setMessageLimit = useSettingsStore((state) => state.setMessageLimit);

const setMessages = useMessageStore((state) => state.setMessages);
const avatarUrl = useUserStore((state) => state.avatarUrl);
const setUserAvatarUrl = useUserStore((state) => state.setUserAvatarUrl);
const headerTitle = useMessageStore((state) => state.headerTitle);
const filtered = useMessageStore((state) => state.filtered);
const setFilter = useMessageStore((state) => state.setFilter);
Expand Down Expand Up @@ -128,6 +129,9 @@ const ChatHeader = ({
const handleLogout = useCallback(async () => {
try {
await RCInstance.logout();
setMessages([]);
setUserAvatarUrl(null);
useMessageStore.setState({ isMessageLoaded: false });
} catch (e) {
console.error(e);
} finally {
Expand Down

0 comments on commit 75f7760

Please sign in to comment.