Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught TypeError: Cannot read property 'removeEventListener' of null #9

Open
mmcnl opened this issue Nov 10, 2020 · 2 comments
Open

Comments

@mmcnl
Copy link

mmcnl commented Nov 10, 2020

First of all, thanks so much @justinfagnani for the great work on this project (and of course on lit-html & LitElement)!

I've been using the chess-board component along with chess.js and in general it's been working wonderfully. However I'm sporadically getting errors like the following:

chessboard-element.ts:1405 Uncaught TypeError: Cannot read property 'removeEventListener' of null
    at HTMLDivElement.transitionComplete (chessboard-element.ts:1405)

Unfortunately so far I've not been able to deduce a pattern (other than this happens when my parent component renders) and so cannot yet provide reliable steps to reproduce. Here's the markup for the chess-board element in my parent component's render function:

          <chess-board
            @drag-start="${this.dragStart}"
            @drop="${this.drop}"
            draggable-pieces
            .orientation=${this.orientation}
            style="width: 80%"
            drop-off-board="snapback"
            position="${this.fen}"
          >
          </chess-board>

Is there anything I'm obviously doing wrong or perhaps do you have any troubleshooting tips? Thanks much!

@mmcnl
Copy link
Author

mmcnl commented Nov 10, 2020

Update: here's another js error I received:

Uncaught (in promise) TypeError: Cannot read property 'addEventListener' of null
    at chessboard-element.ts:1428
    at new Promise (<anonymous>)
    at HTMLElement._dropDraggedPieceOnSquare (chessboard-element.ts:1403)
    at async HTMLElement._stopDraggedPiece (chessboard-element.ts:1577)

@justinfagnani
Copy link
Owner

Hmm... seems like a race condition. I bet the animated piece is sometimes being removed from the DOM before the animation listener is cleaned up. I can take a look in a couple of days.

Thanks for the kind words!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants