Document session persistence bug fix

Update PROMPT.md and scratchpad with complete documentation of the
bug fix for session persistence after page refresh.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
uroma
2026-01-22 14:50:08 +00:00
Unverified
parent c5dbb6c244
commit 2d94e81a3f
2 changed files with 64 additions and 42 deletions

View File

@@ -28,12 +28,44 @@ This ensures sessions always come from the authoritative source (the backend API
## Implementation
Remove the `await this.initialize()` call from `createSessionInFolder()` after `loadProjects()`. The `loadProjects()` call already refreshes the data from the API, so we don't need to re-initialize.
### Fix 1: Reset sessions in loadManuallyCreatedProjects()
File: `project-manager.js` lines 52-87
Modified `loadManuallyCreatedProjects()` to create a sanitized project object with:
- `sessions: []` - Reset to empty array
- `activeSessionId: null` - Reset active session
This prevents stale localStorage session data from overriding fresh API data.
### Fix 2: Remove redundant initialize() call
File: `project-manager.js` lines 542-563
Modified `createSessionInFolder()` to:
- Remove `await this.initialize()` call
- Add `this.renderProjectTabs()` to update UI
- Make `switchProject()` call await properly
This prevents reloading stale localStorage data after fetching fresh API data.
## Commit
Commit: c5dbb6c
"Fix session persistence after page refresh"
## Testing Steps
To verify the fix works:
1. Create new project named 'test'
2. Start new session in 'test' project
3. Check that session appears in left sidebar
4. Refresh page
5. Verify session still appears in 'test' project
5. Verify session still appears in 'test' project's session list
6. Verify session is correctly displayed in left sidebar
## Status
**FIX IMPLEMENTED AND COMMITTED**
The fix ensures:
1. Session data always comes from the API (authoritative source)
2. localStorage only stores project metadata (name, id, workingDir)
3. No stale session data can override fresh API data