Setting alarm and onStateChange

Hello, I'm using onStateChange to propagate state to firestore DB. And it seems to me that onStateChange is called even when there is no actual state changed for example I can see following logs: Writing to Firestore: http://127.0.0.1:8081/v1/projects/teamday-ai/databases/(default)/documents/aiChatV2/0UwNVUblr3HvhkD8SjaX level=INFO msg="scheduling event" ccl=true t=1757490470340 Writing to Firestore: http://127.0.0.1:8081/v1/projects/teamday-ai/databases/(default)/documents/aiChatV2/0UwNVUblr3HvhkD8SjaX level=INFO msg="setting alarm" timestamp=1757490470340 Document written successfully to emulator: projects/teamday-ai/databases/(default)/documents/aiChatV2/0UwNVUblr3HvhkD8SjaX Document written successfully to emulator: projects/teamday-ai/databases/(default)/documents/aiChatV2/0UwNVUblr3HvhkD8SjaX I would assume that internals wouldn't trigger onStateChange - am I missing something here?
6 Replies
jog1t
jog1t3mo ago
Could you share any repro repo? 🙏🏻 We’re using https://www.npmjs.com/package/on-change to detect changes within the state
npm
on-change
Watch an object or array for changes. Latest version: 5.0.1, last published: 2 years ago. Start using on-change in your project by running npm i on-change. There are 113 other projects in the npm registry using on-change.
Nathan
Nathan3mo ago
@jog1t this is because we don't filter on-change events by the user's state. he's probably seen on change events from the connection state + scheduled events
No description
Nathan
Nathan3mo ago
we just need to make sure the property starts with s i'll get that fixed today
jog1t
jog1t3mo ago
thanks Nathan!
Nathan
Nathan3mo ago
this was fixed in 2.0.3 btw
Samko
SamkoOP3mo ago
thanks guys ✨

Did you find this page helpful?