[PR #670] [MERGED] fix(solid): return empty string sentinel from cleanChildren when no replacement #1483

Closed
opened 2026-03-14 09:39:15 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/anomalyco/opentui/pull/670
Author: @Hona
Created: 2/11/2026
Status: Merged
Merged: 2/11/2026
Merged by: @Adictya

Base: mainHead: fix/cleanchildren-undefined-return


📝 Commits (1)

  • da1caf6 fix(solid): return empty string sentinel from cleanChildren when no replacement

📊 Changes

1 file changed (+1 additions, -1 deletions)

View changed files

📝 packages/solid/src/renderer/universal.js (+1 -1)

📄 Description

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 ?? ""

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/anomalyco/opentui/pull/670 **Author:** [@Hona](https://github.com/Hona) **Created:** 2/11/2026 **Status:** ✅ Merged **Merged:** 2/11/2026 **Merged by:** [@Adictya](https://github.com/Adictya) **Base:** `main` ← **Head:** `fix/cleanchildren-undefined-return` --- ### 📝 Commits (1) - [`da1caf6`](https://github.com/anomalyco/opentui/commit/da1caf67e10cd7c36dfd597cc8e7b9fca6653865) fix(solid): return empty string sentinel from cleanChildren when no replacement ### 📊 Changes **1 file changed** (+1 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `packages/solid/src/renderer/universal.js` (+1 -1) </details> ### 📄 Description ## 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 ```diff - return replacement + return replacement ?? "" ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-14 09:39:15 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/opentui#1483
No description provided.