I am developing a web application where users can create an account and join rooms. Once inside a room, they have the ability to click a button that randomly selects another user in the room to give a gift to. My challenge lies in updating a data object in Vue when the database is updated for all users. The issue arises when a new user joins a room - the new user receives the updated data object, but the existing users have outdated information. So my question is, how can Vue update a data object if the database is updated?
When I refer to a data object, it resembles something like this:
data() {
return {
room: { name: "room", users: [] }
}
}
Would the update() lifecycle hook handle this situation, or should I use computed()? And just a reminder, the solution needs to update the data object for ALL users who are part of the room.
I am utilizing Vue2 as well as Vuetify for my development.