Repository navigation
fix(service-map): tiles stay put while you place them - #2545
Conversation
- The camera frames the tiles only, so lifting or putting down a tile no longer refits it and slides the board under the pointer. A bigger board after a deal glides into frame instead of jumping. - Lakes and open country are worked out with a lifted tile still at home: they only move once it lands. - The cell a held tile goes to is the one drawn under the pointer (tile, plate, lake or country), not a ground-plane hit. - The tile in hand is ringed and starts over a cell at once, so it never reads as already placed and Enter works without moving the mouse. - The outer ring of country hides while a tile is held instead of floating as islands, and the footer stays one line so the map never resizes.
Maple review🟡 Confidence 6/10 · needs attention. Held at 6 because a correctness warning is open. Holds the service-map tiles camera, lakes and country still while a tile is lifted, glides the framing when the board grows, and aims at the tile, plate, lake or country drawn under the pointer. Sound apart from a stale
Findings🟠 Warning · F1 ·
|
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 16 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
| ring, | ||
| biome, | ||
| feature, | ||
| key: `${cellKey(cell)}:${biome.id}:${feature}:${palette.night}`, |
There was a problem hiding this comment.
Warning
wildTiles keeps a stale ring when a cell's ring changes
F1 · Warning · correctness
The key omits ring, so a cell going from ring 1 to ring 2 with the same feature keeps its cached entry and is never rebuilt. showOffers (scene.ts:636) reads the stale ring and leaves that island of country visible while a tile is held — the symptom this change removes. Reachable once a tile moves away from a neighbour.
Add `ring` to the key so the cell is rebuilt, and its stored `ring` refreshed, when it changes ring.
| key: `${cellKey(cell)}:${biome.id}:${feature}:${palette.night}`, | |
| key: `${cellKey(cell)}:${ring}:${biome.id}:${feature}:${palette.night}`, |
🤖 Prompt to fix with an AI agent
In `apps/web/src/page/service-map/tiles/scene.ts:623`: `wildTiles` keeps a stale `ring` when a cell's ring changes.
The key omits `ring`, so a cell going from ring 1 to ring 2 with the same feature keeps its cached entry and is never rebuilt. `showOffers` (`scene.ts:636`) reads the stale ring and leaves that island of country visible while a tile is held — the symptom this change removes. Reachable once a tile moves away from a neighbour.
Replace those lines with:
key: `${cellKey(cell)}:${ring}:${biome.id}:${feature}:${palette.night}`,
Verify the problem exists at that location before changing it, and keep the fix to those lines.
Placing tiles on the Tiles view of the service map was unreliable: the board slid under the pointer whenever a tile was lifted or put down, so the cell you aimed at changed and the tile card showed the wrong outcome (e.g. "-1 roads" right after picking a tile up).
What changed
Before / after
Lab
/lab/service-map-tiles, headless Chromium.Before: lifting
ordersrefits the camera (the board shifts and zooms), the lakes move, outer country floats as islands, and the dealt tile sits on a cell looking placed. After: the board holds still, the tile in hand is ringed over its target.Verification
world.test.ts: lifting a tile leaves lakes, country and framing unchanged (fails on main), the lifted tile is offered its own cell back, and a lifted tile starts over its own cell.vitest run src/page/service-map: 345 passed.oxlint -c .oxlintrc.effect.jsonclean, no new tsc errors.🤖 Generated with Claude Code
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.