From 3de4bba017dabde402047448fcaea7387f827b3b Mon Sep 17 00:00:00 2001 From: Yash Johri Date: Sat, 4 Nov 2023 20:52:27 +0530 Subject: [PATCH 1/2] fix: replace structuredClone with Object.assign --- .eslintrc.js | 1 + packages/common/src/dotlottie-player.ts | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index d1ca52e9..5c2b910f 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': 'off', // 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(); From 5efc8c87c025928a9d4a41725e93b635edfec4d8 Mon Sep 17 00:00:00 2001 From: yash1200 Date: Sat, 4 Nov 2023 22:01:45 +0530 Subject: [PATCH 2/2] fix: change off to warn for prefer-object-spread --- .eslintrc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.eslintrc.js b/.eslintrc.js index 5c2b910f..97918349 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -41,7 +41,7 @@ module.exports = { '@typescript-eslint/prefer-for-of': 'off', '@typescript-eslint/dot-notation': 'off', '@typescript-eslint/member-ordering': 'off', - 'prefer-object-spread': 'off', + 'prefer-object-spread': 'warn', // Disable the async generator warning 'no-restricted-syntax': 'off',