Board position resets on toggle edit in certain circumstances
jez9999 opened this issue · comments
Describe the bug
I've noticed the board position resetting on toggle edit in certain circumstances. I suspect it's to do with the following code:
en-croissant/src/components/boards/Board.tsx
Lines 471 to 475 in 8b5c1ac
Why boardFen
gets out of sync with currentNode.fen
I don't know.
Reproduction
- Open a new analysis board
- Toggle 'edit position' and move a piece
- Exit editing mode
- Run engine analysis
- Click on an engine analysis line
- Toggle 'edit position' again (board position resets to what it was before you clicked on the analysis line)
Platform and versions
Windows 10, version 0.10.0.
Stack trace
No response
When the board position resets, it also erases the whole moves list. In fact, switching in and out of edit mode sometimes erases the whole moves list even when no edit is made, which also seems like a bug and is likely related to this bug. Oddly, that doesn't always happen and I can import a PGN, switch in and out of edit mode, and it retains the moves list correctly.
However, the moves list is erased when, for example, you:
- Import a PGN
- Move pieces to create a different continuation
- Switch in and out of edit mode
This should fix both problems