diff --git a/src/games/plugins/sync-clients.ts b/src/games/plugins/sync-clients.ts index 618739ca..e9a05c59 100644 --- a/src/games/plugins/sync-clients.ts +++ b/src/games/plugins/sync-clients.ts @@ -41,7 +41,11 @@ export default fp(async app => { } if (before.events.length < after.events.length) { - app.gateway.broadcast(async () => await GameEventList({ game: after })) + const n = before.events.length - after.events.length + const newEvents = after.events.slice(n) + for (const event of newEvents) { + app.gateway.broadcast(async () => await GameEventList.append({ game: after, event })) + } } await Promise.all( diff --git a/src/games/views/html/game-event-list.tsx b/src/games/views/html/game-event-list.tsx index 8504312e..d965942b 100644 --- a/src/games/views/html/game-event-list.tsx +++ b/src/games/views/html/game-event-list.tsx @@ -24,9 +24,7 @@ const renderedEvents = [ ] export async function GameEventList(props: { game: GameModel }) { - const events = props.game.events - .filter(({ event }) => renderedEvents.includes(event)) - .toSorted((a, b) => b.at.getTime() - a.at.getTime()) + const events = props.game.events.toSorted((a, b) => b.at.getTime() - a.at.getTime()) return (