diff --git a/.eslintrc.js b/.eslintrc.js index d1ca52e9..97918349 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -41,6 +41,7 @@ module.exports = { '@typescript-eslint/prefer-for-of': 'off', '@typescript-eslint/dot-notation': 'off', '@typescript-eslint/member-ordering': 'off', + 'prefer-object-spread': 'warn', // Disable the async generator warning 'no-restricted-syntax': 'off', diff --git a/packages/common/src/dotlottie-player.ts b/packages/common/src/dotlottie-player.ts index 8afd8089..c9e1b44f 100644 --- a/packages/common/src/dotlottie-player.ts +++ b/packages/common/src/dotlottie-player.ts @@ -214,7 +214,8 @@ export class DotLottieCommonPlayer { container?: DotLottieElement | null, options?: DotLottieConfig, ) { - this._src = structuredClone(src); + if (typeof src === 'string') this._src = src; + else this._src = Object.assign({}, src); if (options?.testId) { this._testId = options.testId; @@ -482,7 +483,8 @@ export class DotLottieCommonPlayer { public updateSrc(src: Record | string): void { if (this._src === src) return; - this._src = structuredClone(src); + if (typeof src === 'string') this._src = src; + else this._src = Object.assign({}, src); this._activeAnimationId = undefined; this._currentAnimationId = undefined; this.load();