you don’t need vuex, I just need to see more of the code… below is the basic idea.
i the example you provided
const {state, getLiveDeviceInfo, deviceInfo} = useFirebaseService();
what is state
??
all you need to do is create a ref
and set the value in the ref
and when it changes, any dependent components will re-render.
const deviceInfo = ref<any>(null);
const getLiveDeviceInfo = async (id: string) => {
return await new Promise(function (resolve) {
let returnObj = {};
const threadMembersRef = firebase.firestore().collection('devices').doc(id);
threadMembersRef.onSnapshot(function (doc) {
Object.assign(returnObj, doc.data());
deviceInfo.value = returnObj;
resolve(returnObj);
});
});
};