Files
SuperCharged-Claude-Code-Up…/PROMPT.md
uroma 2d94e81a3f 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>
2026-01-22 14:50:08 +00:00

1.8 KiB

Task: BUG: Session persistence broken after page refresh

Current Behavior

  1. Create new project named 'roman'
  2. Start new chat session in the 'roman' project
  3. Refresh the page
  4. The new session DISAPPEARS from the project's session history/list

Expected Behavior

After page refresh, the session should still appear in the 'roman' project's session list.

Root Cause Identified

The bug was caused by loadManuallyCreatedProjects() restoring projects with STALE session arrays from localStorage. When loadProjects() tried to merge with fresh API data, the stale sessions would override.

Additionally, createSessionInFolder() was calling initialize() after loadProjects(), which would reload stale localStorage data and undo the fresh API data.

Solution Implemented

Fix 1: Reset sessions in loadManuallyCreatedProjects()

  • Modified loadManuallyCreatedProjects() to reset sessions: [] and activeSessionId: null for each loaded project
  • This ensures sessions always come from the API (authoritative source) rather than stale localStorage data

Fix 2: Remove redundant initialize() call

  • Modified createSessionInFolder() to remove the await this.initialize() call
  • Added direct this.renderProjectTabs() call to update UI
  • This prevents reloading stale localStorage data after fetching fresh API data

Files Modified

  • /home/uroma/obsidian-web-interface/public/claude-ide/project-manager.js
    • Lines 52-87: Modified loadManuallyCreatedProjects()
    • Lines 542-563: Modified createSessionInFolder()

Success Criteria

  1. Create new project 'test'
  2. Start new session in 'test' project
  3. Refresh page
  4. Session still appears in 'test' project's session list
  5. Session is correctly displayed in left sidebar

Status

COMPLETE - Fix implemented and committed (c5dbb6c)