opencode icon indicating copy to clipboard operation
opencode copied to clipboard

fix(tui): move props.ref to onMount

Open itsrainingmani opened this issue 1 week ago • 2 comments

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

itsrainingmani avatar Jan 10 '26 20:01 itsrainingmani

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

github-actions[bot] avatar Jan 10 '26 20:01 github-actions[bot]

@rekram1-node This is the PR for the code I was talking about earlier

itsrainingmani avatar Jan 10 '26 20:01 itsrainingmani

/review

rekram1-node avatar Jan 11 '26 06:01 rekram1-node

lgtm

github-actions[bot] avatar Jan 11 '26 06:01 github-actions[bot]