pacosako
pacosako copied to clipboard
Rollback of chain should not roll back start of move promotion
Yorick reported on WhatsApp
This is even stranger. When your turn starts and you get to promote at the start, then the button to rollback is available. It should not be available and it correctly does nothing.
After you have promoted, the button could arguably be available (It is your time after all so why not do a different decision) - But it is not available.
Now after you lift a piece, the option becomes available and fully rolls back your move including the promotion at the start.
I tried to fix this by pushing the "Required Action" into the current match state. And then I wanted to derive it from that.
That still doesn't allow me do differentiate between "Your turn started, Lift a piece" and "You just promoted and now get to lift". Only in the second position is a rollback allowed.
It seems like Rollback behaves like a "Legal Action" so I should try to derive it in client JavaScript instead.
Elm Side: LegalActionsResponse
Rust (Wasm) Side: LegalActionsDeterminedData
Happy with the state I have with the bf2b7acd9c5c557191da5db8b6d8f59e87779f95 commit. The button now uses library logic (wasm) and shows up exactly when a rollback would do something. If I change library logic in the future, the frontend will adapt :-)