Appearance
Simulator Last Successful Combo Cache Plan
Background
The simulator page allows developers to paste mapHex, optional pathHex, and optional roomProperties for real-time rendering. Refreshing the page currently risks losing in-progress data.
Goal And Scope
Persist the last successfully rendered combination locally so developers can refresh and continue without data loss.
In scope:
- Save input combo after successful render.
- Restore input combo on page load.
- Fallback to built-in demo defaults when no cache hit exists.
- Provide an explicit cache clear action.
Out of scope:
- Cross-device sync.
- Server-side persistence.
- IndexedDB migration.
Chosen Approach
- Use browser
localStoragewith keyrayRobotMap:simulator:lastSuccessfulCombo:v1. - Store payload with version and timestamp:
mapHexpathHexroomProperties
- Read and validate cache shape at startup.
- Only persist when full render completes without layer errors.
- Keep render behavior unchanged for optional inputs.
- Add
清除缓存action to remove stored combo manually.
Impacted Files Or Modules
docs/.vitepress/theme/components/MapPlayground.vue
Verification Checklist
npm run lintpasses (project lint scope currently coverssrconly).npm run docs:buildpasses.npx tsc --noEmitstill fails due existing unrelated test typing issues intest/core/application/Interaction.test.ts.