[PR #12235] fix: preserve session content when creating new session #14129

Open
opened 2026-02-16 18:18:56 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/12235

State: open
Merged: No


Issue

When clicking "New Session" from the command dialog (Ctrl+P), session content was only preserved once. After the first time, content would be lost on subsequent new sessions.

Root Cause

The "once" variable was defined at module level outside the Home component. This meant it could only work once across the entire app lifecycle.

Fix

Move the "once" variable inside the Home component function scope so it resets properly on each component mount. This ensures content is always preserved when opening a new session.

Fixes: #12239

Changes

  • Moved "let once = false" from module scope into Home() component function
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/12235 **State:** open **Merged:** No --- ## Issue When clicking "New Session" from the command dialog (Ctrl+P), session content was only preserved once. After the first time, content would be lost on subsequent new sessions. ## Root Cause The "once" variable was defined at module level outside the Home component. This meant it could only work once across the entire app lifecycle. ## Fix Move the "once" variable inside the Home component function scope so it resets properly on each component mount. This ensures content is always preserved when opening a new session. Fixes: [#12239](https://github.com/anomalyco/opencode/issues/12239) ## Changes - Moved "let once = false" from module scope into Home() component function
yindo added the pull-request label 2026-02-16 18:18:56 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#14129