Closed MalikKilgore closed 3 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.
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)
This issue has been fixed by focusing on just using the Firebase snapshot listener.