MalikKilgore / VueChat

VueChat is a video chat application where you can send, edit, and delete messages both in public chatrooms and in private DMS.
https://vuechat-80a67.web.app/
0 stars 0 forks source link

VueX state is updated, but computed property in Vue doesn't update objects or arrays when they have new properties added or removed. #1

Closed MalikKilgore closed 3 years ago

MalikKilgore commented 4 years ago
MalikKilgore commented 4 years ago

Can probably make msgList an empty array. Push all the doc.content to that array. Commit the array to the mutation.

Within the mutation, cycle through the array and push those items to the state. This should make it so the state can be overwritten all the time, without having to manually reset it to being empty.

MalikKilgore commented 4 years ago

Using code similar to below. Use a UL in Message.vue, and append doc.content as list items. Can loop through to remove all list items everytime renderDOM() initiates.

const div = document.createElement('div') div.classList.add('message') div.innerHTML =${doc.data()} div.innerHTML =${doc.data().content} document.getElementById(chat-messages).appendChild(div)

src/store/index.js

MalikKilgore commented 3 years ago

This issue has been fixed by focusing on just using the Firebase snapshot listener.