soroban-abacus-flashcards/apps/web
Thomas Hallock 07c25a2296 fix: lazy-load map data in know-your-world validator
Fix production error where know-your-world game failed to load sessions due to ES module imports in CommonJS context.

**Problem:**
- Validator imported maps.ts at module init time
- maps.ts statically imports @svg-maps/world and @svg-maps/usa (ES modules)
- Server (CommonJS) cannot require() ES modules synchronously
- Error: "Unexpected token 'export'"

**Solution:**
- Make validateMove() async (already supported by GameValidator interface)
- Lazy-load getFilteredMapData() only when needed via dynamic import()
- Prevents ES module loading until validator method is actually called
- Client-side code continues to work normally (bundled by Next.js)
- Mark know-your-world page as force-dynamic to avoid SSR issues

**Changes:**
- GameValidator.validateMove: Now supports Promise<ValidationResult>
- KnowYourWorldValidator: Use getFilteredMapDataLazy() wrapper
- session-manager: Await validator.validateMove()
- know-your-world page: Add dynamic = 'force-dynamic' export

Fixes the "Failed to fetch session" error for know-your-world game.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-20 07:24:27 -06:00
..
.claude fix: lazy-load map data in know-your-world validator 2025-11-20 07:24:27 -06:00
.storybook fix: refactor worksheet config persistence to blacklist approach + Storybook stories 2025-11-13 11:26:36 -06:00
__tests__
content/blog
data
docs
drizzle
e2e
public
scripts
src fix: lazy-load map data in know-your-world validator 2025-11-20 07:24:27 -06:00
.dockerignore.test
.gitignore
CARD_SORTING_PORT_PLAN.md
COMPLEMENT_RACE_PORT_PLAN.md
DEVELOPMENT_STANDARDS.md
LINTING.md
README.md
biome.jsonc
drizzle.config.ts
eslint.config.js
next-env.d.ts
next.config.js
package.json Revert "feat: use big.js for arbitrary precision in cursor and zoom math" 2025-11-19 19:24:07 -06:00
panda.config.ts fix: refactor worksheet config persistence to blacklist approach + Storybook stories 2025-11-13 11:26:36 -06:00
playwright.config.ts
pnpm-lock.yaml
server.js debug: add error handling for socket-server require to see actual failure 2025-11-20 05:51:24 -06:00
svg-processing-test.js
test-arcade-api.sh
test-flashcards-final.pdf
test-flashcards.pdf
test-simplified.pdf
test_fullscreen_persistence.html
test_panda_simple.html
tsconfig.json
tsconfig.server.json
vitest.config.ts

README.md

Test deployment - Mon Nov 3 16:31:57 CST 2025