Giter Club home page Giter Club logo

Comments (11)

willb335 avatar willb335 commented on July 29, 2024 1

Ok, thanks

I'm looking into it now.

from chessboardjsx.

willb335 avatar willb335 commented on July 29, 2024 1

going to have to figure this out later today. it's a bug with how the board his handling the prevState and currentState

from chessboardjsx.

willb335 avatar willb335 commented on July 29, 2024 1

I'm going to expose a new prop called undo to fix this for now.

I wrote the chessboard to compare positions only if the current position is different than the previous position and when the current position becomes the previous position then there is no comparing.

I'll try to code up a demo sometime soon

from chessboardjsx.

willb335 avatar willb335 commented on July 29, 2024 1

Check out this branch : https://github.com/willb335/chessboardjsx/tree/undo
Run npm run start
Click the Undo demo

In the demo I set all pieces except the knights to 'undo' by specifying an undo prop

Wish I could have integrated a fix without an extra prop but couldn't see an easy way without a substantial rewrite.

Let me know if this works!

from chessboardjsx.

willb335 avatar willb335 commented on July 29, 2024

Check out the fork of your demo below. I believe it was an async issue with setState. I changed

this.setState(...)
setTimeout(this.setState(...), 1000)

to

this.setState(..., () => setTimeout(this.setState(...), 1000) )

just put the setTimeout into the initial setState's callback.

let me know if this solves the issue
https://codesandbox.io/s/2xpxvq06wj

from chessboardjsx.

slig avatar slig commented on July 29, 2024

Hi!

Thank you for checking this issue.

On my end I'm still seeing the same problem. Opening the Dev Console, I see that it prints the fen correctly, but the UI stills shows the older state.

Here for instance I moved Kg2, and I'm hovering the f2 pawn:

screen shot 2018-10-09 at 09 08 34

Thank you very much!

from chessboardjsx.

willb335 avatar willb335 commented on July 29, 2024

*prevPos and currentPos

from chessboardjsx.

slig avatar slig commented on July 29, 2024

Thank you very much! Will try and get back to you.

from chessboardjsx.

slig avatar slig commented on July 29, 2024

Just tested and this works. Thank you for working on this fix!

from chessboardjsx.

willb335 avatar willb335 commented on July 29, 2024

great! i'll update the docs and push up a new release soon

from chessboardjsx.

willb335 avatar willb335 commented on July 29, 2024

closed by:
2fff88a

from chessboardjsx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.