Autofetch or Live does not work with useMoralisCloudFunction()

Have been trying to get data from my classes automatically through my cloud function as such
const { data } = useMoralisCloudFunction(“renderChat”, {}, { autoFetch: true, live:true });

and it does not seem to work I have looked around and there does seem to be some inconsistency with automatic and live fetching in cloud functions could someone get back to me

1 Like

Cloud function doesn’t have live and can’t refetch because of the way they work. You can trigger them automatically in the first render, but you need to trigger them manually next times. Live and autoFetch for update only works on db.

2 Likes

A simple way around is using the useMoralisSubscription hook which will trigger your useMoralisCloudFunction again if any update is received on the DB

2 Likes