diff --git a/src/components/ChatBox.vue b/src/components/ChatBox.vue index 9ed092c..4c85315 100644 --- a/src/components/ChatBox.vue +++ b/src/components/ChatBox.vue @@ -34,7 +34,14 @@ }, setup() { const store = useStore(), - messages = computed(() => store.state.chat.messages); + componentSettings = computed(() => store.state.components.chatBox), + messages = computed(() => { + if(componentSettings.value!.messageHistory) { + return store.state.chat.messages.slice(componentSettings.value!.messageHistory); + } else { + return store.state.chat.messages; + } + }); return { messages, diff --git a/src/store/mutations.ts b/src/store/mutations.ts index e293919..631bea5 100644 --- a/src/store/mutations.ts +++ b/src/store/mutations.ts @@ -242,10 +242,6 @@ export const mutations: MutationTree & Mutations = { //Adds chat messages from an update fetch to the chat history [MutationTypes.ADD_CHAT](state: State, chat: Array) { state.chat.messages.unshift(...chat); - - if(state.components.chatBox && isFinite(state.components.chatBox.messageHistory)) { - state.chat.messages.splice(state.components.chatBox.messageHistory); - } }, //Pops the specified number of marker updates from the pending updates list