lichess-org / chessground

Mobile/Web chess UI for lichess.org
https://lichess.org
GNU General Public License v3.0
1.05k stars 260 forks source link

Exception starting from 7.8.0 #148

Closed vjuneja closed 4 years ago

vjuneja commented 4 years ago

I am using the react-chessground component instead of using chessground directly so I have also filed this issue with them, but pretty sure it is caused by this checkin https://github.com/ornicar/chessground/commit/c190c1823f5836aebc156a248289fa300a248675#diff-a2fcebf1963fad0da40a844a8d67da83R48


This exception started happening with version 7.8.0 of chessground. For a temporary fix, I have hardcoded my yarn.lock file to version chessground@7.7.2.

Thanks.

TypeError: _a.get is not a function
computeSquareClasses
src/render.ts:221
render
src/render.ts:16
  13 | if (isPieceNode(el)) {
  14 |     pieceAtKey = pieces.get(k);
  15 |     anim = anims.get(k);
> 16 |     fading = fadings.get(k);
     | ^  17 |     elPieceName = el.cgPiece;
  18 |     if (el.cgDragging && (!curDrag || curDrag.orig !== k)) {
  19 |         el.classList.remove('dragging');
View compiled
redrawNow
src/chessground.ts:25
  22 |     bounds.clear();
  23 |     render_1.updateBounds(state);
  24 |     if (elements.svg)
> 25 |         svg.renderSvg(state, elements.svg);
     | ^  26 | };
  27 | state.dom = {
  28 |     elements,

Screen Shot 2020-07-19 at 2 51 08 PM

ornicar commented 4 years ago

can you reproduce that issue with chessground alone?

vjuneja commented 4 years ago

cg.zip

Yes. If you unzip the attached folder and open test.htm in your browser. I didnt bother working on the css so ignore that the board looks massive and just click on any piece and see the exception in the console.

If i send the movable object as a map instead of an object, the exception goes away. If that is the expectation from clients going forward, you can close this bug and react-chessground component will need to be fixed.

Although in that case, I don't think it should have been part of a minor version update.

ornicar commented 4 years ago

clients need to use Map since 7.8

purefan commented 4 years ago

For anyone with breaking changes, here is an example of how to do it now: https://github.com/ornicar/chessground-examples/blob/28ceac2c878c0187b5ad69aa68c5e25eba9f71ff/src/util.ts#L4