Preserve saved availability filter when opening research

This commit is contained in:
coyotte508 2026-10-29 10:20:35 +01:00
commit df95e5eda0
6 changed files with 17 additions and 6 deletions

View file

@ -570,3 +570,11 @@ request is reached. Invalid choices ask again; earlier rounds and the final age
not offer this queue. Previously saved status-phase choices remain compatible.
Verified 894 frontend/engine tests, locales, Svelte checks, production build and
engine compatibility checks.
### 0.1.174 — Preserve the research availability filter
Opening research no longer overrides the saved availability filter. Queued free
research previously forced Available, while ordinary research forced All. Both
entry points now honor the player's saved preference, including after refresh.
Verified preference persistence tests, Svelte checks and production build.
Engine remains 0.4.118.

View file

@ -1,12 +1,12 @@
{
"name": "@boardgamers/clash-web-client",
"version": "0.1.173",
"version": "0.1.174",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@boardgamers/clash-web-client",
"version": "0.1.173",
"version": "0.1.174",
"dependencies": {
"@boardgamers/protocol": "0.9.0",
"lucide-svelte": "^0.577.0",

View file

@ -1,6 +1,6 @@
{
"name": "@boardgamers/clash-web-client",
"version": "0.1.173",
"version": "0.1.174",
"private": true,
"type": "module",
"scripts": {

View file

@ -566,7 +566,6 @@
mode: 'research',
tilePanel: false,
selectedAdvance: (earlyAdvance?.selected as {SelectAdvance?: string} | null)?.SelectAdvance ?? null,
availableOnly: !!earlyAdvance,
error: '',
abilitiesOpen: false,
});

View file

@ -25,7 +25,7 @@
{#if !raze && !first}<label for={'early-' + offer.key}>{offer.title}</label>{/if}
{#if offer.key.endsWith('/advance')}
<div class="choice-row">
<button class="primary" disabled={$session.pending} onclick={() => controller.patch({mode: 'research', selectedAdvance: (offer.selected as {SelectAdvance?: string} | null)?.SelectAdvance ?? null, availableOnly: true})}>
<button class="primary" disabled={$session.pending} onclick={() => controller.patch({mode: 'research', selectedAdvance: (offer.selected as {SelectAdvance?: string} | null)?.SelectAdvance ?? null})}>
{saved >= 0 ? offer.options[saved].label : 'Choose an advance'}
</button>
{#if saved >= 0}<button disabled={$session.pending} onclick={() => controller.submit({QueueChoice:{key:offer.key,response:null}})}>Clear</button>{/if}

View file

@ -154,9 +154,13 @@ test('map view, orientation and unit badges round-trip through BGS preferences a
viewer.updatePreference('homeAtBottom', true);
assert.equal(current.homeAtBottom, true);
assert.equal(writes, 3);
viewer.updatePreference('availableOnly', true);
viewer.updatePreference('availableOnly', false);
assert.equal(current.availableOnly, false);
viewer.destroy();
const reopened = createViewer(options);
reopened.emitter.receive('preferences', saved);
assert.equal(current.availableOnly, false, 'show-all survives reopening the viewer');
assert.equal(current.homeAtBottom, true);
assert.equal(current.topDown, true);
assert.equal(current.unitBadges, false);
@ -173,7 +177,7 @@ test('opponent recap defaults to autoplay and restores the player’s manual pre
assert.equal(readPreferences({ replayAutoplay: true }).replayAutoplay, true);
});
test('availability filtering defaults on and restores the player’s show-all preference', () => {
test('availability filtering defaults off and restores the player’s show-all preference', () => {
assert.equal(readPreferences({}).availableOnly, false);
assert.equal(readPreferences({ availableOnly: true }).availableOnly, true);
assert.equal(readPreferences({ availableOnly: false }).availableOnly, false);