Firestore onSnapshot doesn't rerun dmx.app.set?

Firestore has a method called onSnapshot that listens to changes in the underlying data and updates the client in realtime. I haven’t been able to get it to work in Wappler so far and would appreciate some help.

function stripeSubscriptionGet(firebase_uid) {
return firebase.firestore()
	.collection('stripe_customers')
	.doc(firebase_uid)
	.collection('subscription')
	.onSnapshot(results => {
        const subscription_ids = results.docs.map(doc => doc.id);
        dmx.app.set('stripe_subscriptions', subscription_ids);
        return subscription_ids;
    });
}

This function is supposed to automatically update stripe_subscriptions whenever Firestore detects a change in the database but that hasn’t been the case for me.

Community Page
Last updated: