You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The issue is when setting autoShapes to an empty array like so after it is set to an array of length > 0, the change is not reflected in the underlying chessground module
The crux of the problem is the merge function in config.ts in the chessground package merges the previous state and the current config (props). for const key in extend where extend is an empty array does nothing
I was able to hack around this problem by patching the render function in react-chessground/chessground.js to include
if (this.cg && this.props.drawable && this.props.drawable.autoShapes) {
this.cg.setAutoShapes(this.props.drawable.autoShapes);
}
I think there is probably a better way to fix this, but I am not that familiar with React. I think cg.setAutoShapes needs to be leveraged somehow
The text was updated successfully, but these errors were encountered:
+1 to using the chessGround setAutoShapes here - I think just adding that API to the chessground wrapper should suffice. Going to make a fork that does that (mostly for my own use but I will send a pull request)
The issue is when setting autoShapes to an empty array like so after it is set to an array of length > 0, the change is not reflected in the underlying chessground module
The crux of the problem is the
merge
function inconfig.ts
in the chessground package merges the previous state and the current config (props).for const key in extend
whereextend
is an empty array does nothingI was able to hack around this problem by patching the render function in
react-chessground/chessground.js
to includeI think there is probably a better way to fix this, but I am not that familiar with React. I think
cg.setAutoShapes
needs to be leveraged somehowThe text was updated successfully, but these errors were encountered: