Store updates in db smartly

Let’ say i have a do with list of items e.g (Array) and I debounce storing the updates every 10 seconds, if a User A moves the item 1 → 2 and same User A movies back 2 → 1 (immediately), the document will last in the same state as original… and in 10 seconds I merge these updates and store them, but this update is not really useful as its the same as the previous version.

Is there a way to check if the update don’t change the doc meaningful and ignore it or wait for a more meaningful change?

The problem is that in a collaborative environment, you have to commit each shareable change before you know if it will be reversed. If user A moves the item 1 → 2, that change is committed and shared with all other clients. If User A moves the item back 2 → 1, the other clients may already be working off 2, so you cannot safely reset that change. You have to let the CRDT do its work to avoid conflicts.

It is possible to create a new Doc with a blank history and encode just the current state, but then you have to deal with migrating clients from the old Doc to the new Doc.