mirror of
https://github.com/anomalyco/opentui.git
synced 2026-04-25 13:06:00 +03:00
[GH-ISSUE #432] Bug: conditional sibling causes insertBefore crash in <box> #111
Labels
No labels
bug
core
documentation
feature
good first issue
help wanted
pull-request
question
react
solid
tmux
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/opentui#111
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @IsraelAraujo70 on GitHub (Dec 19, 2025).
Original GitHub issue: https://github.com/anomalyco/opentui/issues/432
Originally assigned to: @msmps on GitHub.
Summary
When rendering a
<textarea>and then conditionally rendering a sibling<line-number>before it (after the textarea ref becomes available), OpenTUI crashes with:Error: Anchor does not exist
at insertBefore (Renderable.ts:1161:17)
This looks like React trying to
insertBefore()into a<box>container, but the anchor resolution fails.Environment
@opentui/core: 0.1.62@opentui/react: 0.1.62react: 19.2.3Steps to Reproduce
<textarea>and store its instance via a callback ref.<line-number target={textareaInstance} />before the textarea once the ref is set.Minimal repro:
Expected
mounts and attaches to the textarea without crashing.
Actual
Crash with Error: Anchor does not exist coming from insertBefore.
Notes / Suspected Cause
@msmps commented on GitHub (Dec 22, 2025):
@IsraelAraujo70 i will look into this but was there a reason you needed to set the target over using parent/child?
@IsraelAraujo70 commented on GitHub (Dec 26, 2025):
@msmps Thanks for the suggestion! I tried wrapping the
<textarea>with<line-number>as you showed:However, I'm now getting a different error when switching between files/buffers (when the textarea gets unmounted):
It seems like when React tries to unmount the child , the <line-number> component doesn't handle the removal correctly through the React reconciler.<br> Is there a way to properly handle this? Maybe the React bindings need to call clearTarget() before removing the child?</p> </body></html>
@kommander commented on GitHub (Dec 27, 2025):
Mhh to support react with the LineNumberRenderable properly, it should probably handle
clearTargetinternally when the target is removed. Would be more aligned with other APIs in the core.