Add session-scoped state and improve Springboard dev/runtime behavior#72
Add session-scoped state and improve Springboard dev/runtime behavior#72mickmister wants to merge 5 commits into
Conversation
When user code in src/ changes, the ModuleRunner re-imports the module but doesn't call start() again. This meant engine.initialize() never ran after HMR, so newly registered modules never executed their callbacks. Now handleHotUpdate detects src/ changes and schedules start() to run after the module reloads, ensuring the engine re-initializes and modules get their callbacks invoked. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace fragile /src/ string check with robust path-based logic: - Check file starts with project root - Exclude node_modules, .springboard, and dist directories - Use path.sep for cross-platform compatibility Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Implement a new state management API that uses sessionStorage for tab-specific, temporary state that clears when the browser tab closes. Changes: - Add BrowserSessionKVStoreService wrapping sessionStorage - Add session storage to CoreDependencies with optional support - Add sessionSharedStateService to ModuleDependencies - Implement createLocalSessionState in StatesAPI with fallback - Initialize session storage in browser and Tauri entrypoints - Update state management documentation with new state type The implementation includes graceful fallback to localStorage when sessionStorage is not available, ensuring backward compatibility. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Allow the node server to use PORT environment variable at runtime instead of having the port locked in at compile time. Falls back to the configured port (__PORT__) if PORT is not set. This enables more flexible deployment scenarios where the port needs to be configured at runtime rather than build time. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Ignore additional KV database file to prevent local database files from being committed to the repository. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
Claude finished @mickmister's task —— View job Code Review AnalysisReviewing the VK wrapper app pull request for code quality, best practices, and potential issues. Todo List:
Review SummaryThis PR implements a new session storage-based state management API ( 🟢 Positive Aspects
|
Deploying jamtools-docs-new with
|
| Latest commit: |
7b8f423
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://358bd25d.jamtools-docs-new.pages.dev |
| Branch Preview URL: | https://vk-6c2d-vk-wrapper-app.jamtools-docs-new.pages.dev |
Summary
This PR improves Springboard development/runtime behavior and adds a new tab-scoped state primitive for browser-based apps.
What changed
createLocalSessionStateto the module state API for state backed bysessionStorage.BrowserSessionKVStoreServiceand wired optional session storage through browser, offline browser, Tauri browser, and generated web entrypoints.process.env.PORTat runtime, falling back to the configured build-time port.LocalSessionStatestate type and when to use it.kv-2.dbto.gitignoreto avoid committing local KV database files.Why
The branch supports building richer Springboard apps that need browser-tab-specific UI/navigation state without persisting it across sessions or syncing it across devices. This is useful for temporary app state such as wizard progress, tab-local drafts, or per-window navigation state.
It also improves the local development loop: when app source changes, the Springboard engine is re-initialized after HMR so newly registered/updated modules run correctly. Runtime
PORTsupport makes generated node builds easier to deploy in environments where the port is assigned dynamically.Implementation details
CoreDependencies.storage.sessionis optional so non-browser or older integrations can continue without providing session storage.Springboard.initialize()creates aSharedStateServicefor session storage only whenstorage.sessionexists, then exposes it throughModuleDependencies.services.sessionSharedStateService.StatesAPI.createLocalSessionState()uses the session shared-state service when available and falls back to user-agent/local storage when session storage is unavailable.BrowserSessionKVStoreService(sessionStorage)and pass it intostartAndRenderBrowserApp.node_modules,.springboard, anddist, then schedulesnodeEntryModule.start()after reload.