Skip to content

Save game state to LocalStorage#5

Open
T3nak wants to merge 1 commit intosoldag:mainfrom
T3nak:persistence
Open

Save game state to LocalStorage#5
T3nak wants to merge 1 commit intosoldag:mainfrom
T3nak:persistence

Conversation

@T3nak
Copy link

@T3nak T3nak commented Jan 9, 2026

On several occasions I have accidentally pulled-to-refresh my browser and lost my scoring after 5+ minutes in.

This PR aims to prevent lost of scoring progress by saving your game state in LocalStorage. When CreateGameView is loaded, your previous state will be restored and you will be redirected to the ForestView automatically.

Once you're done with scoring, or start scoring a new game, your old game state will be cleared.

After an app version update, your game state from the previous app version will not be loaded anymore.

This PR also fixes what I believe was an issue with the QR code importing - the cards that got imported were not removed from the Game.deck state, but now they are. See importPlayerData in src/game/sharing/import.ts for those changes.

Disclaimer: I don't have experience with React

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