opencode
opencode copied to clipboard
fix(tui): move props.ref to onMount
Fixes: #7633 & possibly #7634
What does this PR do?
Currently there is an issue where forking from the first message of a session causes a fatal crash since
the session route calls r.set(route.initialPrompt) immediately after receiving the ref, but theinput is not valid until the textarea component is ready later on-down in the component hierarchy.
This PR moves the Prompt props.ref logic into the onMount lifecycle component to ensure that the ref is only invoked when the component is fully ready.
How did you verify your code works?
https://github.com/user-attachments/assets/180de7a3-a277-4f3f-953c-4d7931833bb8