From 7d755d1c524ca0462d47153bb3e18d7d37350c58 Mon Sep 17 00:00:00 2001 From: Ilya Zhidkov Date: Sun, 18 May 2025 23:59:37 +0300 Subject: [PATCH 1/2] Fix: prevent infinite recursion in deepmerge by extracting children prop - Updated ReactPlayer to destructure and exclude children from props before merging with defaultProps. - This prevents deepmerge from causing infinite recursion when children are present. - Children are now explicitly passed to the underlying player component, enabling custom content without recursion issues. --- src/ReactPlayer.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ReactPlayer.tsx b/src/ReactPlayer.tsx index e8569194..58aa640f 100644 --- a/src/ReactPlayer.tsx +++ b/src/ReactPlayer.tsx @@ -33,7 +33,7 @@ export const createReactPlayer = (players: PlayerEntry[], playerFallback: Player return null; }; - const ReactPlayer: ReactPlayer = React.forwardRef((_props, ref) => { + const ReactPlayer: ReactPlayer = React.forwardRef(({ children, ..._props } , ref) => { const props = merge(defaultProps, _props); const { src, slot, className, style, width, height, fallback, wrapper } = props; @@ -87,6 +87,7 @@ export const createReactPlayer = (players: PlayerEntry[], playerFallback: Player ? { display: 'block', width: '100%', height: '100%' } : { display: 'block', width, height, ...style }} config={config} + children={children} /> ); }; From 5ac4a59c23b72862bb4287932df60efcfcaf5465 Mon Sep 17 00:00:00 2001 From: Wesley Luyten Date: Mon, 19 May 2025 12:15:27 -0500 Subject: [PATCH 2/2] Update src/ReactPlayer.tsx --- src/ReactPlayer.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/ReactPlayer.tsx b/src/ReactPlayer.tsx index 58aa640f..efc4ad08 100644 --- a/src/ReactPlayer.tsx +++ b/src/ReactPlayer.tsx @@ -87,8 +87,7 @@ export const createReactPlayer = (players: PlayerEntry[], playerFallback: Player ? { display: 'block', width: '100%', height: '100%' } : { display: 'block', width, height, ...style }} config={config} - children={children} - /> + >{children} ); };