-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix: merge circular dependency #1964
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,3 +11,4 @@ yarn-error.log | |
| .vscode/ | ||
| /disttest/ | ||
| /dist/ | ||
| tsconfig.tsbuildinfo | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,5 +1,4 @@ | ||||||||||
| import React, { lazy, Suspense, useEffect, useState } from 'react'; | ||||||||||
| import merge from 'deepmerge'; | ||||||||||
|
|
||||||||||
| import { defaultProps } from './props.js'; | ||||||||||
| import Player from './Player.js'; | ||||||||||
|
|
@@ -33,8 +32,8 @@ export const createReactPlayer = (players: PlayerEntry[], playerFallback: Player | |||||||||
| return null; | ||||||||||
| }; | ||||||||||
|
|
||||||||||
| const ReactPlayer: ReactPlayer = React.forwardRef(({ children, ..._props } , ref) => { | ||||||||||
| const props = merge(defaultProps, _props); | ||||||||||
| const ReactPlayer: ReactPlayer = React.forwardRef((_props, ref) => { | ||||||||||
| const props = { ...defaultProps, ..._props }; | ||||||||||
|
|
||||||||||
| const { src, slot, className, style, width, height, fallback, wrapper } = props; | ||||||||||
| const [showPreview, setShowPreview] = useState(!!props.light); | ||||||||||
|
|
@@ -83,19 +82,19 @@ export const createReactPlayer = (players: PlayerEntry[], playerFallback: Player | |||||||||
| activePlayer={player.player ?? (player as unknown as PlayerEntry['player'])} | ||||||||||
| slot={wrapper ? undefined : slot} | ||||||||||
| className={wrapper ? undefined : className} | ||||||||||
| style={wrapper | ||||||||||
| ? { display: 'block', width: '100%', height: '100%' } | ||||||||||
| : { display: 'block', width, height, ...style }} | ||||||||||
| style={ | ||||||||||
| wrapper | ||||||||||
| ? { display: 'block', width: '100%', height: '100%' } | ||||||||||
| : { display: 'block', width, height, ...style } | ||||||||||
| } | ||||||||||
| config={config} | ||||||||||
| >{children}</Player> | ||||||||||
| /> | ||||||||||
|
||||||||||
| /> | |
| > | |
| {children} | |
| </Player> |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shallow merging props will overwrite nested default objects (e.g., config) instead of merging them. Consider deep merging specific sub-properties like config to preserve nested defaults, for example:
config: { ...defaultProps.config, ..._props.config }.