fix(ui-map): apply wrap-mode flips in place instead of remounting
Tests · UI / test (push) Successful in 2m51s

The previous logic re-mounted the renderer whenever
`store.wrapMode` flipped, because the `sameSnapshot` gate
included `handle.getMode() === mode`. Pixi 8 does not reliably
re-initialise an `Application` on the same canvas — the symptom
showed up as the chromium tab silently closing during the
Phase 29 wrap-mode e2e ("Target page, context or browser has
been closed").

The renderer already exposes an in-place `setMode` that swaps
the wrap-clamp / torus-copy visibility synchronously while
preserving the camera; the playground-map.spec.ts wrap toggle
has been driving it for several phases without issue. Drop
mode from the snapshot gate and route the change through
`handle.setMode(mode)` instead.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ilia Denisov
2026-05-19 22:33:38 +02:00
parent 7c46aa4bec
commit 2f4dc01d54
+11 -2
View File
@@ -227,9 +227,18 @@ preference the store already manages.
const sameSnapshot =
mountedTurn === report.turn &&
mountedGameId === gameId &&
handle !== null &&
handle.getMode() === mode;
handle !== null;
if (sameSnapshot) {
// Apply wrap-mode flips in-place via the renderer's own
// `setMode` — a full re-mount is unnecessary (the world,
// primitives, and camera are unchanged) and Pixi 8 does
// not reliably re-init on the same canvas (the symptom is
// a crashed tab when the wrap-mode radio fires).
if (handle !== null && handle.getMode() !== mode) {
untrack(() => {
handle?.setMode(mode);
});
}
// Always re-apply hide set + fog on a same-snapshot pass:
// toggle flips bypass the extras fingerprint when they
// only change which baked-world primitives are hidden,