fix: prevent prompt crash when opening new session with existing prompt
fixes #7541
fixed this fatal error when creating a new session would crash if you had prompt in the textarea.
prompt component in home.tsx is not defined onMount yet, now it handles the timing better and keeps your prompt text (tested with ctrl+x n) when moving to a new session. when selecting new session from the dialog the text is not always preserved.
note: #7702 fixes switched sessions & forks. this fix is for new sessions
before:
https://github.com/user-attachments/assets/01d58e94-002a-4929-b925-4af69b32c4e3
after:
https://github.com/user-attachments/assets/684f27ba-7bb0-4d68-93d9-1e410a962de9
The following comment was made by an LLM, it may be inaccurate:
Found a potential related PR:
PR #4878: "Fixed: prompt now preserved when creating new session"
- https://github.com/anomalyco/opencode/pull/4878
This PR appears to address a very similar issue - preserving prompt text when creating a new session. While it's an older PR, it deals with the same core functionality that PR #7764 is fixing (preventing crashes and preserving prompt text during session transitions).
friendly ping @rekram1-node