Fix miniboard staleness

pull/9993/head
Albert Ford 2021-10-20 00:50:17 -07:00
parent 70a24bb277
commit 893984bfa3
No known key found for this signature in database
GPG Key ID: 9C200032321A04A3
1 changed files with 8 additions and 2 deletions

View File

@ -1,7 +1,6 @@
import Ctrl from './ctrl';
import { h } from 'snabbdom';
import { Game } from './interfaces';
import { onInsert } from 'common/snabbdom';
function miniGame(game: Game) {
return h(
@ -15,7 +14,14 @@ function miniGame(game: Game) {
[
h('span.mini-board.is2d', {
attrs: { 'data-state': `${game.fen},${game.color},${game.lastMove}` },
hook: onInsert(el => lichess.miniBoard.init(el)),
hook: {
insert(vnode) {
lichess.miniBoard.init(vnode.elm as HTMLElement);
},
update(vnode) {
lichess.miniBoard.init(vnode.elm as HTMLElement);
},
},
}),
h('span.vstext', [
h('span.vstext__pl', [