fix(ui-e2e): tighten Phase 29 effect tracking + radio wiring
Tests · UI / test (push) Failing after 7m19s
Tests · UI / test (push) Failing after 7m19s
Run #217 surfaced three independent bugs that survived the first fixup pass: 1. `visibleHighBitCount` masked the id with `(prim.id >>> 0) & 0xf…`, but JS bitwise AND always returns a signed int32 — the mask had to be re-converted with `>>> 0` AFTER the AND, not before. Result was always 0 on the previous run, masking the next two bugs by making the persistence test's high-bit-count assertions a tautology. 2. `applyVisibilityState` was wrapped in `untrack`, so the `toggles.X` reads inside `computeHiddenIds` / `computeFogCircles` never landed in the effect's dependency set — toggling fog or any marker / group / kind flag did not re-run the effect, so the renderer never received the new hide / fog input. Explicit `void toggles.X` reads now live at the top of the effect so every key is tracked synchronously. 3. The wrap-mode radios fired on `onchange`, which Svelte 5 suppresses on a re-activation of an already-checked input — the Playwright `.click()` flake on the second wrap test reflected the missed event. Switched to `onclick` and short-circuited when the target mode is already active. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -34,7 +34,15 @@ bottom-tabs bar.
|
||||
void store.setMapToggle(key, event.currentTarget.checked as MapToggles[K]);
|
||||
}
|
||||
|
||||
/**
|
||||
* setWrap is wired to the radios' `onclick`, not `onchange`, so the
|
||||
* Playwright `.click()` action on the input fires the callback even
|
||||
* when the input is already checked (the `change` event suppresses
|
||||
* the second activation, which made the wrap-mode e2e flake).
|
||||
* `onclick` also fires reliably on touch / pointer activation.
|
||||
*/
|
||||
function setWrap(mode: WrapMode): void {
|
||||
if (store.wrapMode === mode) return;
|
||||
void store.setWrapMode(mode);
|
||||
}
|
||||
|
||||
@@ -192,7 +200,7 @@ bottom-tabs bar.
|
||||
data-testid="map-toggles-wrap-torus"
|
||||
value="torus"
|
||||
checked={store.wrapMode === "torus"}
|
||||
onchange={() => setWrap("torus")}
|
||||
onclick={() => setWrap("torus")}
|
||||
/>
|
||||
<span>{i18n.t("game.map.toggles.wrap.torus")}</span>
|
||||
</label>
|
||||
@@ -203,7 +211,7 @@ bottom-tabs bar.
|
||||
data-testid="map-toggles-wrap-no-wrap"
|
||||
value="no-wrap"
|
||||
checked={store.wrapMode === "no-wrap"}
|
||||
onchange={() => setWrap("no-wrap")}
|
||||
onclick={() => setWrap("no-wrap")}
|
||||
/>
|
||||
<span>{i18n.t("game.map.toggles.wrap.no_wrap")}</span>
|
||||
</label>
|
||||
|
||||
@@ -177,6 +177,24 @@ preference the store already manages.
|
||||
if (!mounted || canvasEl === null || containerEl === null) return;
|
||||
if (status !== "ready" || !report || toggles === undefined) return;
|
||||
|
||||
// Explicit reads of every toggle key — Svelte 5's deep proxy
|
||||
// tracks per-property access, and the actual consumers
|
||||
// (computeHiddenIds, computeFogCircles, buildExtras) run
|
||||
// inside `untrack` blocks or async continuations where the
|
||||
// tracking would otherwise be lost. Touching every key here
|
||||
// synchronously guarantees a flip triggers the effect.
|
||||
void toggles.hyperspaceGroups;
|
||||
void toggles.incomingGroups;
|
||||
void toggles.unidentifiedGroups;
|
||||
void toggles.foreignPlanets;
|
||||
void toggles.uninhabitedPlanets;
|
||||
void toggles.unidentifiedPlanets;
|
||||
void toggles.unreachablePlanets;
|
||||
void toggles.cargoRoutes;
|
||||
void toggles.battleMarkers;
|
||||
void toggles.bombingMarkers;
|
||||
void toggles.visibilityFog;
|
||||
|
||||
// Phase 29 visibility derivation. Cargo routes and pending-
|
||||
// Send overlay are extras (no Pixi remount on flip); the
|
||||
// cascade-filtering happens here so the extras list shrinks
|
||||
|
||||
Reference in New Issue
Block a user