mirror of
https://github.com/anomalyco/opentui.git
synced 2026-04-25 04:55:58 +03:00
[PR #201] [MERGED] Fix(core): insertBefore not rendering conditional children with siblings after them #1149
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#1149
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?
📋 Pull Request Information
Original PR: https://github.com/anomalyco/opentui/pull/201
Author: @eli0shin
Created: 10/6/2025
Status: ✅ Merged
Merged: 10/6/2025
Merged by: @kommander
Base:
main← Head:fix-conditional-children-in-insertBefore📝 Commits (1)
14dee5bFix(core): insertBefore not rendering conditional children with siblings after them📊 Changes
2 files changed (+15 additions, -1 deletions)
View changed files
📝
packages/core/src/Renderable.ts(+2 -1)📝
packages/core/src/tests/renderable.test.ts(+13 -0)📄 Description
Resolves https://github.com/sst/opentui/issues/197
Issue
Conditional React elements with sibling elements after them were not rendering. For example:
Root Cause
insertBefore()hadelse if (renderable.parent)that only handled children transferring from different parents. New children (whererenderable.parentis null) had no initialization code at all - they weren't added to either tracking array or registered in the parent's map.Children need to be in both:
_childrenInLayoutOrder(for layout)_childrenInZIndexOrder(for rendering)New children were missing both, making them invisible and inaccessible.
Fix
Changed
else if (renderable.parent)toelseto handle both transferred children AND new children. Added missing_childrenInZIndexOrder.push(renderable)to ensure children are properly tracked for rendering.Test
Added test verifying
insertBefore()makes new children accessible viagetRenderable().🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.