Skip to content

Commit

Permalink
Merge pull request #601 from vtex-apps/fix-slot-children
Browse files Browse the repository at this point in the history
Use props children in slots if their slot children prop is empty
  • Loading branch information
victorhmp authored Feb 2, 2021
2 parents 6a8b8d0 + d23bd8e commit 6fc44c7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

### Fixed
- Use props `children` in slots if slot children is empty.

## [8.126.10] - 2021-01-26

### Fixed
Expand Down
6 changes: 5 additions & 1 deletion react/utils/slots.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@ export function generateSlot({
runtime={runtime}
hydration={hydration}
>
{slotChildren}
{Array.isArray(slotChildren) &&
slotChildren.length === 0 &&
componentLoaderPropsWithContent.children
? componentLoaderPropsWithContent.children
: slotChildren}
</ComponentLoader>
)
}
Expand Down

0 comments on commit 6fc44c7

Please sign in to comment.