Chesser icon indicating copy to clipboard operation
Chesser copied to clipboard

Position occasionally reverts back to starting position

Open nayyala opened this issue 2 years ago • 2 comments

Plugin informations (please complete the following information):

  • OS: Windows 11
  • Chesser version: most recent
  • Obsidian version: 1.3

Describe the bug When I first compile the Chesser block, everything is great and it render. But then upon making an edit, it seems to first revert back to the starting position. I then move my cursor back into the chesser block and it fixes itself at the second try. It works but is very annoying to constantly deal with.

Expected behavior Once the Chesser block is created, it should persist the FEN every time it's compiled

https://github.com/SilentVoid13/Chesser/assets/8975517/a2733676-cbc3-45a5-9b8e-8f6f7149bc13

nayyala avatar Jun 02 '23 13:06 nayyala

I tried putting a little bit of work into this issue. I did come up with one quick fix, which was to instantiate the Chess object with the confi.fen string (if it exists). If a page has chesser and the positions have already been rendered, if you close and open that page, it will open with the correctly rendered position. However, if you attempt to edit the chesser block or otherwise look at its markdown, it will alternate between rendering the initial board state and the correct board position.

My guess is that there is either a null exception or that there are too many attempts to load FEN strings. A better way to deal with FEN strings isn't to keep loading them but to construct a singleton Chess object with the FEN string that is then used forever and doesn't permit new FEN strings to be loaded.

latenitecoding avatar Jan 29 '24 18:01 latenitecoding

I'm not as happy with my fix since I haven't been able to stop it from alternating positions, but I can send you what I have so far if you're interested. It's enough for me I think to just be able to open a note with the correct positions. I don't open the chesser blocks very often.

latenitecoding avatar Jan 29 '24 18:01 latenitecoding