Hey all, I am using react-moralis and the useMoralisSubscription hook to listen to sync’d events in my moralis database server. Everything works perfectly. The server listens for events from my smart contract getting emitted and then my dapp instantly updates when a new event is added to the database.
My problem is that for some reason this gets triggered twice per event entry. After about 2 minutes my useMoralisSubscription hook is triggered again despite no new entry being added to the database.
below is the code.
useMoralisSubscription('SupplyChanges', (q) => q.limit(1), [], {
onUpdate: (data) => {
console.log('SERVER EVENT TRIGGERED!');
initializeDataFromServer(data);
},
});