Skip to content

Fix default-slot interpolation for component - #79

Merged
koculu merged 1 commit into
mainfrom
default-slot-interpolation-for-component
Mar 25, 2026
Merged

koculu merged 1 commit into
mainfrom
default-slot-interpolation-for-component

Conversation

@koculu

@koculu koculu commented Mar 25, 2026

Copy link
Copy Markdown
Member

This PR fixes a component slot rendering bug where text-only default slot content could overwrite the rendered component root.

When a component was used like <Btn>{{ busy ? 'Saving...' : 'Save Host' }}</Btn>, interpolation converted the host text node into an r-text binding on the component host. During component binding, that binding was inherited by the rendered root element, replacing its children. In the reported case, the button still showed Save Host, but its internal structure was lost, including the icon and .btn__label wrapper.

The fix updates slot expansion so that host-level r-text on a component with default slot content is consumed as slot content instead of falling through to the component root. This preserves the component subtree while keeping the interpolated slot text reactive.

The PR also adds a regression test covering the nested Toolbar -> Btn -> Icon scenario to ensure interpolated slot content renders correctly inside the button label without removing surrounding component markup.

@koculu
koculu merged commit 7101230 into main Mar 25, 2026
1 check passed
@koculu
koculu deleted the default-slot-interpolation-for-component branch March 25, 2026 02:36
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.

1 participant