Skip to content

Commit 1a78d64

Browse files
author
Hector Arce De Las Heras
committed
Ensure isPlayingInitially is set in CarouselUnControlledComponent
This commit modifies the isPlayingInitially property in the CarouselUnControlledComponent to use a ternary operator. This change ensures that isPlayingInitially is set to false when props.pageControlAutomateConfig is undefined, preventing isPlayingInitially from potentially being undefined itself. By default, isPlayingInitially is now set to true, improving the component's robustness and predictability.
1 parent d30edf5 commit 1a78d64

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/components/carousel/carouselUnControlled.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,10 @@ const CarouselUnControlledComponent = <V extends string | unknown>(
132132

133133
const { handleClickMediaButton, handleMouseOver, handleMouseOut, isPlaying } = useAutomateControl(
134134
{
135-
isPlayingInitially: props.pageControlAutomateConfig?.playingInitially,
135+
isPlayingInitially:
136+
props.pageControlAutomateConfig !== undefined
137+
? props.pageControlAutomateConfig.playingInitially
138+
: false,
136139
onClickMediaButton: props.pageControlAutomateConfig?.playStop.onClick,
137140
}
138141
);

0 commit comments

Comments
 (0)