Skip to content

Commit 075a33b

Browse files
authored
Don't render hook steps with no content (#361)
1 parent f440962 commit 075a33b

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](http://semver.org/).
77

88
## [Unreleased]
9+
### Fixed
10+
- Don't render hook steps with no content ([#361](https://github.com/cucumber/react-components/pull/361))
911

1012
## [22.3.0] - 2024-08-02
1113
### Added

src/components/gherkin/HookSteps.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@ interface IProps {
1010
export const HookSteps: React.FunctionComponent<IProps> = ({ hookSteps }) => {
1111
return (
1212
<>
13-
{hookSteps.map((step, index) => (
14-
<li key={index}>
15-
<HookStep key={index} step={step} />
16-
</li>
17-
))}
13+
{hookSteps
14+
.map((step, index) => <HookStep key={index} step={step} />)
15+
.filter((el) => !!el.props.children?.length)
16+
.map((el, index) => (
17+
<li key={index}>{el}</li>
18+
))}
1819
</>
1920
)
2021
}

0 commit comments

Comments
 (0)