Persist and restore Excel sidebar session tabs across reload
Session from pi-for-excel-sessions on Hugging Face by thomasmustier · MIT · condensed by Coders Talk
Click a segment to jump to that moment
44msession
1interventions
GOAL
Fix a bug where reloading the Excel taskpane sidebar dropped all but one open session tab, so tabs would persist and restore correctly per workbook.
- +0Prompt · +0We just implemented tabs, but reloading the sidebar removes all tabs but one
- +0mAgent did · +0mExplored the codebase (session-runtime-manager, init.ts, sessions.ts, workbook design docs) to find where tab state was and wasn't persisted across reload.
- +3mAgent did · +3mAdded src/taskpane/tab-layout.ts to persist per-workbook tab layout (session ids + active tab) in SettingsStore, wired persistence/restore hooks into init.ts, and added tests/tab-layout.test.ts.
- +10mAgent did · +10mFixed resulting lint/typecheck errors, split out resume-target.ts, ran full check/test suite, committed 'fix(tabs): persist and restore session tabs on reload', rebased on origin/main, and pushed.
- +39mIntervention · +39mAfter reloading, the developer found the old tabs still disappeared and said the fix didn't work.Why: I reloaded and the tabs still vanished, so the persistence code wasn't actually being used on startup — needed to check what was really wired in.
- +40mFail · +40mInvestigation showed restorePersistedTabLayout wasn't hooked into the runtime bootstrap path — the earlier fix never actually ran on load.
- +42mAgent did · +42mRewrote init.ts to call restorePersistedTabLayout before falling back to single-session restore, handle missing session records by recreating blank tabs, and reran lint/typecheck/tests, all passing.
- +44mOutcome · +44mCommitted 'fix(tabs): restore persisted tab layout on sidebar reload' and pushed to main as b6c5863; lint, typecheck and test:context all passed with 0 npm audit vulnerabilities.
VERDICT
Next time I'd ask upfront for the fix to include a manual verification step (actually reload and check tabs) before calling it done, since the first commit passed all checks but never actually wired the restore into the boot path. My interruption — reloading and pointing out the tabs still disappeared — was what forced the agent to find that the persistence code wasn't hooked up at all, which was the real bug.