Detect changes if pinned object is valid

I don’t know if there is a feature about this, couldn’t really find something about it.
I query an object from the client SDK side, after retrieving it I pin it into the local data store. let’s assume that the retrieved object has been updated/deleted from the server-side, other than querying the object and pinning it again, is there any way to check if the pinned object is still valid or if it has been updated? for example in a chat messaging app (that caches the messages) that has a feature to edit a message, how would you detect if a message has been updated and pin it again?

If you want to have real time updates, you can use Live Query. Otherwise, you will have to refetch the object.

LiveQuery can detect only when the app is running, but if some changes were made when the app isn’t running I have to query and pin the object again?

They way I do:

  1. query from local storage and show the latest data I have
  2. connect to live query
  3. once live query is connected, I take a snapshot from the server, update local storage, and show updated data
  4. for each live query event, update local storage, and show updated data