Skip to content

Fix no-wasm support (lots of bugs, sad)#484

Merged
rbtying merged 8 commits intomasterfrom
fix-wasm-rpc-optimizations
Sep 13, 2025
Merged

Fix no-wasm support (lots of bugs, sad)#484
rbtying merged 8 commits intomasterfrom
fix-wasm-rpc-optimizations

Conversation

@rbtying
Copy link
Owner

@rbtying rbtying commented Sep 13, 2025

Also, do a bunch of caching to avoid extra RPCs

rbtying and others added 8 commits September 13, 2025 05:49
- Add ?no-wasm=true URL parameter to force RPC mode for debugging
- Fix RPC serialization issues with HashMap<PlayerID, _> by adding custom Deserialize
- Implement automatic cache prefilling when cards encounter uncached trumps
- Prevent O(n) duplicate requests with promise-based tracking mechanism
- Ensure cards wait for active prefills instead of making individual requests

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
- Use stable string key for cards in hand to prevent unnecessary re-renders
- Only re-run sorting when actual card content changes, not just object references
- This reduces repeated sortAndGroupCards calls during gameplay

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
- Create stable key from actual hand data (card->count mapping) instead of derived array
- Prevents unnecessary re-renders when hands object reference changes but content is same
- Properly memoizes the key generation to avoid recreating it every render

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
- Better error messages when JSON parsing fails
- Log the actual response text for debugging
- This will help identify if server is returning non-JSON error messages

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
- Wrap boolean response in a struct to work with serde tag="type"
- Update both RPC and WASM versions to return { reachable: bool }
- Fix frontend to handle the new response structure
- Add better error logging to diagnose JSON parsing issues

The issue was that serde cannot serialize a primitive boolean as a tagged enum variant.

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
- Add ?no-wasm=true URL parameter support for debugging RPC mode
- Fix duplicate batchGetCardInfo requests by tracking active prefills
- Optimize React dependency tracking to prevent unnecessary re-renders
- Fix NextThresholdReachable RPC serialization error
- Ensure WASM and RPC versions maintain consistent API
- Remove excessive console.log statements (keeping no-WASM mode log)
- Update TypeScript types for new response structures

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

Co-Authored-By: Claude <noreply@anthropic.com>
@rbtying rbtying merged commit 007e6d2 into master Sep 13, 2025
4 checks passed
@rbtying rbtying deleted the fix-wasm-rpc-optimizations branch September 13, 2025 06:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant