Sync the history and the local store

When using the strope.mam plugin we can get the conversation history. How do you guys sync/compare the same message that is coming from the chat history and the locally stored ones?

  1. Assume that you type ‘hi’
  2. Then you locally update the UI.
  3. Then while you scroll up, the history gets updated and then the same ‘hi’ message come from the history as well. How do you sync the messages in this scenario?