Skip to content

Commit

Permalink
fix: TypeError: Cannot read properties of undefined
Browse files Browse the repository at this point in the history
Previous commit did not fix well
  • Loading branch information
sunner committed May 28, 2023
1 parent bfcbe3b commit 47bfbb4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ export default createStore({
},
setChatContext(state, { botClassname, context }) {
const currentChat = state.chats[state.currentChatIndex];
if (currentChat.contexts == undefined) currentChat.contexts = {};
currentChat.contexts[botClassname] = context;
},
clearMessages(state) {
Expand All @@ -123,6 +124,7 @@ export default createStore({
if (state.messages.length > 0) {
const chat = {
title: i18n.global.t("chat.newChat"),
contexts: {},
messages: state.messages,
};
state.chats[0] = chat;
Expand Down

0 comments on commit 47bfbb4

Please sign in to comment.