movex icon indicating copy to clipboard operation
movex copied to clipboard

A fail safe state sync resets local state

Open GabrielCTroia opened this issue 1 year ago • 0 comments

When a fwd action returns different checksums, and thus the fail state sync kicks in, by default it rests the local state to the global state.

First solution is to figure why the state fails on a fwd action, which will fix this by itself, but then also, need to think of a strategy to do with local state (created in the meantime) – does it just get applied over each time, instead of being reset fro 0.

But now I'm thinking that actually this could always be a case, when there area local state changes simultaneously, the checksums won't match anymore, so what needs to happen is to see what is the latest checksum that matched, apply the changes from there and then the local on top of it!

So pretty much this:

                     local-1       master     local-2

checksums: aaa aaa aaa // all states are in sync aaa aaa aa2 // local-2 made local changes without dispatching aa1 -> aa1 <- aa2

WAAAAIT - Forget all this! There is no way you hold a state locally without pushing to master. Movex does that automatically on each dispatch. So, if you hold a stat locally, without dispatching, that is on you – it's not part of movex so you need to make sure to apply it on top anytime movex changes.

GabrielCTroia avatar Aug 02 '23 06:08 GabrielCTroia