fix: persist session across refresh + PWA icon 404 (#9)#10
Merged
Conversation
autoLoad/deserialize and saveHistory/loadHistory all existed but were never wired, so every refresh started from a fresh empty engine and lost all git state. Add hydrate() (called once on boot from main.ts) to restore engine state and command history, and persist history after each command. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Manifest icon src used leading-slash absolute paths (/icons/...) that resolve to the domain root and 404 on the GitHub Pages project subpath. Use relative paths so they resolve against the manifest URL under /gitverse/. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
|
Addresses PR #10 review: - await hydrate() before mount so the graph and terminal render already populated and no early command can race the restore (was fire-and-forget) - replace the "git init to begin" banner with a restored-session notice so the terminal no longer contradicts a populated graph - guard saveHistory/loadHistory against storage failures, matching autoSave/autoLoad, so a floating saveHistory can't emit an unhandled rejection - reset the history store between tests for order-independence Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
autoLoad/deserializeandsaveHistory/loadHistorywere all defined but never called — every boot created a fresh emptyGitEngine, whileautoSavehappily wrote state nothing ever read back. Addedhydrate()(called once frommain.ts) to restore engine state + command history on boot, and persist history after each command.srcused leading-slash absolute paths (/icons/...) that resolve to the domain root, missing the/gitverse/project subpath. Switched to relative paths so they resolve against the manifest URL.Test plan
tests/store/engine.test.ts— restore / no-save / corrupt-save / history restore / history persist (wrote failing first)npm run typecheck— 0 errorsnpm run lint+format:check— cleannpm run build— generated manifest now emits"src":"icons/icon-192.svg"with"scope":"/gitverse/"Closes #9
🤖 Generated with Claude Code