Skip to content

fix(solid): return empty string sentinel from cleanChildren when no replacement#670

Merged
Adictya merged 1 commit intomainfrom
fix/cleanchildren-undefined-return
Feb 11, 2026
Merged

fix(solid): return empty string sentinel from cleanChildren when no replacement#670
Adictya merged 1 commit intomainfrom
fix/cleanchildren-undefined-return

Conversation

@Hona
Copy link
Member

@Hona Hona commented Feb 11, 2026

Summary

  • Fix cleanChildren in the forked universal renderer to return "" instead of undefined when called without a replacement, matching solid-js's upstream behavior

Problem

When cleanChildren is called without a marker or replacement (e.g. when Show/Switch hides content), the no-marker early-return path returns replacement — which is undefined. The solid-js upstream returns "".

This undefined propagates as the current value through insertExpression's reactive chain, eventually corrupting downstream memo reads and causing crashes like:

TypeError: undefined is not an object (evaluating 'grouped().length')

Introduced in #169 when the universal renderer was forked from solid-js.

Fix

- return replacement
+ return replacement ?? ""

…eplacement

The forked universal renderer diverged from solid-js's upstream behavior
in cleanChildren(). When called without a marker or replacement (e.g.
when Show/Switch hides content), it returned `replacement` which is
`undefined`, instead of returning "" like solid-js does.

This caused undefined to propagate through the reactive graph as the
`current` value in insertExpression, eventually corrupting downstream
memo reads.

Introduced in #169 when the universal renderer was forked.
Copilot AI review requested due to automatic review settings February 11, 2026 03:27
@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 11, 2026

@opentui/core

npm i https://pkg.pr.new/anomalyco/opentui/@opentui/core@670

@opentui/react

npm i https://pkg.pr.new/anomalyco/opentui/@opentui/react@670

@opentui/solid

npm i https://pkg.pr.new/anomalyco/opentui/@opentui/solid@670

@opentui/core-darwin-arm64

npm i https://pkg.pr.new/anomalyco/opentui/@opentui/core-darwin-arm64@670

@opentui/core-darwin-x64

npm i https://pkg.pr.new/anomalyco/opentui/@opentui/core-darwin-x64@670

@opentui/core-linux-arm64

npm i https://pkg.pr.new/anomalyco/opentui/@opentui/core-linux-arm64@670

@opentui/core-linux-x64

npm i https://pkg.pr.new/anomalyco/opentui/@opentui/core-linux-x64@670

@opentui/core-win32-arm64

npm i https://pkg.pr.new/anomalyco/opentui/@opentui/core-win32-arm64@670

@opentui/core-win32-x64

npm i https://pkg.pr.new/anomalyco/opentui/@opentui/core-win32-x64@670

commit: da1caf6

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Aligns the forked Solid universal renderer with upstream Solid behavior by ensuring cleanChildren returns the empty-string sentinel ("") instead of undefined when no replacement node is provided, preventing undefined from propagating through insertExpression’s reactive updates.

Changes:

  • Update cleanChildren’s no-marker early return to replacement ?? "" to preserve Solid’s empty-string sentinel semantics.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Collaborator

@Adictya Adictya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I for the life of me can't find the thread of the bug removing this initially solved, i guess this was a holdover from experimenting with having text without surrounding tags. Explored more edge cases locally as well seems to be fine for now. And if opencode is working then it must be holdover only. Will still keep an eye out

@Adictya Adictya merged commit 9be516a into main Feb 11, 2026
22 checks passed
@kommander kommander deleted the fix/cleanchildren-undefined-return branch February 11, 2026 08:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants