Loading a world clears cards left from the last one (t11)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-24 01:04:25 -04:00
co-authored by Claude Opus 5.5
parent e0525c1cfb
commit 259ad89ded
5 changed files with 24 additions and 3 deletions
+1 -1
View File
@@ -374,7 +374,7 @@ Saves in IndexedDB, world files (export / import) and the blueprint library.
- functions: newWorldId, worldWrite, listWorlds, putWorldEntry, worldNewest, deleteWorld, renameWorld, migrateWorlds, saveWorld, newestSave, b64FromBytes, bytesFromB64, gz, exportWorld, importWorldFile, libLoad, libSave, bpEncode, bpValid, bpDecode - functions: newWorldId, worldWrite, listWorlds, putWorldEntry, worldNewest, deleteWorld, renameWorld, migrateWorlds, saveWorld, newestSave, b64FromBytes, bytesFromB64, gz, exportWorld, importWorldFile, libLoad, libSave, bpEncode, bpValid, bpDecode
- variables: DB, worldIdTime, worldIdCounter, worldWrites - variables: DB, worldIdTime, worldIdCounter, worldWrites
### src/ui/session.js (122 lines) ### src/ui/session.js (125 lines)
Starting, loading and quitting a game; modal dialogs; the pause menu. Starting, loading and quitting a game; modal dialogs; the pause menu.
- functions: showLoading, enterGame, startNewWorld, startFromSave, quitToTitle, refreshContinue, anyModal, openModal, closeModal, closeAllModals, topModal, dialog, openPause, renderWorlds - functions: showLoading, enterGame, startNewWorld, startFromSave, quitToTitle, refreshContinue, anyModal, openModal, closeModal, closeAllModals, topModal, dialog, openPause, renderWorlds
+10
View File
@@ -4,6 +4,16 @@ What agents have done, newest first. Add an entry for every piece of work: the d
note or request it was for, what changed, the files touched, the tests run, and anything left note or request it was for, what changed, the files touched, the tests run, and anything left
open or not verified. Keep each entry short; the git history has the details. open or not verified. Keep each entry short; the git history has the details.
## 2026-10-24: t11 Welcome and first milestone shown again on an older world (Claude Code, Codex)
- Cause: nothing cleared the discovery cards (`#cards`) when a world was entered, so a new
world's Welcome and milestone cards stayed up after loading an older world.
- `src/ui/session.js`: `enterGame` clears the cards, floaters, particles and the status line;
a new world still shows its Welcome card afterwards.
- `test/play.py`: a new world shows Welcome; loading a world from the list shows no cards.
- Tests: `run_all.py --browser` passes (153 `play.py` checks). `t_smooth`'s half-resolution
check flaked (passed and failed on reruns, with and without this change; the machine was busy).
## 2026-10-24: the to-do list moved from NOTES.md to a kandown board (Claude Code) ## 2026-10-24: the to-do list moved from NOTES.md to a kandown board (Claude Code)
Request: initialize kandown (https://kandown.dev, 0.52.0) for the project, move all the notes Request: initialize kandown (https://kandown.dev, 0.52.0) for the project, move all the notes
+3
View File
@@ -5,6 +5,9 @@ function showLoading(on, p) {
if (on) { $('loadbar').style.width = Math.round((p || 0) * 100) + '%'; $('loadtext').textContent = Math.round((p || 0) * 100) + '%'; } if (on) { $('loadbar').style.width = Math.round((p || 0) * 100) + '%'; $('loadtext').textContent = Math.round((p || 0) * 100) + '%'; }
} }
function enterGame() { function enterGame() {
$('cards').innerHTML = '';
if (R.floaters) R.floaters.length = 0; R.particles.length = 0;
GAME.status = ''; GAME.statusT = 0;
$('title').hidden = true; $('hud').hidden = false; $('title').hidden = true; $('hud').hidden = false;
GAME.running = true; GAME.paused = false; GAME.running = true; GAME.paused = false;
buildSky(); resizeRender(); snapCamera(); buildSky(); resizeRender(); snapCamera();
+8 -2
View File
@@ -1,10 +1,16 @@
--- ---
id: t11 id: t11
title: Welcome and first milestone shown again on an older world title: Welcome and first milestone shown again on an older world
status: Todo status: Review
created: 2026-10-24 created: 2026-10-24
updated: 2026-10-24T04:41:46Z updated: 2026-10-24T05:04:13Z
tags: [bug] tags: [bug]
order: 5
report: |
(agent) Fixed: loading a world now clears the cards in the lower right, so cards from the
world you were just in (Welcome, first milestone) no longer carry over.
To check: make a new world, quit to the title, load an older world from Worlds. No Welcome
or milestone card should show. A brand-new world still shows its Welcome card.
--- ---
## Context ## Context
+2
View File
@@ -45,6 +45,7 @@ with sync_playwright() as p:
if not pg.is_visible('#nw-seed'): pg.click('#btn-new') if not pg.is_visible('#nw-seed'): pg.click('#btn-new')
pg.fill('#nw-seed', str(seed)); pg.click('#btn-generate') pg.fill('#nw-seed', str(seed)); pg.click('#btn-generate')
pg.wait_for_function('GAME.running', timeout=20000) pg.wait_for_function('GAME.running', timeout=20000)
check(f'new world {seed} shows the Welcome card', pg.evaluate("[...$('cards').children].some(c => c.textContent.includes('Welcome'))"))
pg.evaluate('quitToTitle()') pg.evaluate('quitToTitle()')
pg.wait_for_function("!$('title').hidden") pg.wait_for_function("!$('title').hidden")
pg.click('#btn-worlds'); pg.locator('#m-worlds').wait_for(state='visible') pg.click('#btn-worlds'); pg.locator('#m-worlds').wait_for(state='visible')
@@ -61,6 +62,7 @@ with sync_playwright() as p:
row = pg.locator(f'[data-world="{ids[str(seed)]}"]') row = pg.locator(f'[data-world="{ids[str(seed)]}"]')
row.get_by_role('button', name='Load', exact=True).click(); pg.wait_for_function('GAME.running') row.get_by_role('button', name='Load', exact=True).click(); pg.wait_for_function('GAME.running')
check(f'Load switches to seed {seed}', pg.evaluate('worldSeed') == seed and pg.evaluate('GAME.worldId') == ids[str(seed)]) check(f'Load switches to seed {seed}', pg.evaluate('worldSeed') == seed and pg.evaluate('GAME.worldId') == ids[str(seed)])
check(f'loading seed {seed} shows no cards left from another world', pg.evaluate("$('cards').children.length") == 0)
pg.evaluate('quitToTitle()'); pg.click('#btn-worlds') pg.evaluate('quitToTitle()'); pg.click('#btn-worlds')
row = pg.locator(f'[data-world="{ids["222"]}"]') row = pg.locator(f'[data-world="{ids["222"]}"]')
row.get_by_role('button', name='Rename', exact=True).click() row.get_by_role('button', name='Rename', exact=True).click()