fix(ui): no-op when re-selecting the turn already on screen
Clicking the current-turn row in the header turn navigator while already viewing it routed through returnToCurrent() → viewTurn(currentTurn), which re-fetches the live report and flips the view through `loading`. At turn 0 the only row is the live turn, so the dropdown always fired a pointless backend round-trip and redraw. Guard goToTurn() against re-selecting the on-screen turn (turn === viewedTurn): just close the popover and stop. Leaving history is unaffected — there the viewed turn differs from the target. Closes #45 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -179,8 +179,12 @@ arrows step `viewedTurn` by ±1 (disabled at boundaries `0` and
|
||||
popover (desktop) or a fixed full-width drawer (mobile, ≤ 767.98
|
||||
px) listing every turn from `currentTurn` down to `0`. Selecting
|
||||
the current-turn row routes through `gameState.returnToCurrent()`;
|
||||
any other row calls `gameState.viewTurn(N)`. The popover reuses
|
||||
`view-menu.svelte`'s outside-click / Escape pattern.
|
||||
any other row calls `gameState.viewTurn(N)`. Selecting the row
|
||||
already on screen (`viewedTurn`) is a pure no-op — it only closes
|
||||
the popover — so re-picking the live turn (most visibly turn 0,
|
||||
where it is the only row) never re-fetches the report to redraw the
|
||||
same snapshot. The popover reuses `view-menu.svelte`'s
|
||||
outside-click / Escape pattern.
|
||||
|
||||
`lib/header/history-banner.svelte` renders directly under the
|
||||
header whenever `gameState.historyMode === true`. It shows
|
||||
|
||||
Reference in New Issue
Block a user