Skip to content

[6.x] Fix named slots rendering empty inside nested partials - #15341

Open
duncanmcclean wants to merge 1 commit into
6.xfrom
nested-partial-named-slots
Open

[6.x] Fix named slots rendering empty inside nested partials#15341
duncanmcclean wants to merge 1 commit into
6.xfrom
nested-partial-named-slots

Conversation

@duncanmcclean

Copy link
Copy Markdown
Member

This pull request fixes an issue where named slots passed to a partial would render empty when that partial wrapped its body in another partial that uses {{ slot }}.

This was happening because checkPartialForNamedSlots treated any child node named slot as a named slot definition. The non-paired {{ slot:title }} output tags inside the inner partial pair were picked up as definitions, reduced to empty strings (they have no children) and overwrote the real slot content in the context passed to the inner partial.

This PR fixes it by only treating paired {{ slot:name }}...{{ /slot:name }} tags as named slot definitions.

Fixes #8437

`checkPartialForNamedSlots` picked up non-paired `{{ slot:title }}` output tags inside a nested partial pair, reducing them to empty strings and overwriting the real slot content.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TDjs3WSZv7K4p2bX6e1DZ9
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.

Named slots possibly clashing with {{ slot }} variable and not rendering content to page.

1 participant