From 4c04a62f4404e4ae60794876b9a707464b957fad Mon Sep 17 00:00:00 2001 From: Hamzah Ullah Date: Mon, 6 Jan 2025 12:44:27 -0500 Subject: [PATCH] fix: replace `structuredClone` with `_cloneDeep` (#1243) --- package-lock.json | 17 +++++++++-------- package.json | 2 +- src/components/app/data/constants.js | 3 ++- src/components/app/data/services/programs.js | 3 ++- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/package-lock.json b/package-lock.json index 073499c3dc..abf03670c0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -63,7 +63,7 @@ "videojs-youtube": "3.0.1" }, "devDependencies": { - "@edx/browserslist-config": "1.1.1", + "@edx/browserslist-config": "1.4.0", "@edx/typescript-config": "1.1.0", "@faker-js/faker": "8.4.1", "@openedx/frontend-build": "14.0.14", @@ -2196,10 +2196,11 @@ "license": "GPL-3.0-or-later" }, "node_modules/@edx/browserslist-config": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@edx/browserslist-config/-/browserslist-config-1.1.1.tgz", - "integrity": "sha512-baLX2wxguWNXLIAi26l/iUIJoI9T8LVDH+8+3xP3HjFtWSCOVjz19sgxx4PlWwwMkbUkVmfuxrm2XVueqI6xLw==", - "dev": true + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@edx/browserslist-config/-/browserslist-config-1.4.0.tgz", + "integrity": "sha512-/nUVlFuri0N6R9jaU6ah39FGosUcGhJyH+7a6Sg9fkjzqDHIRpS6PB7OFM91i8UvHJQs4iQ3qZ8yHw7ianzPCw==", + "dev": true, + "license": "AGPL-3.0" }, "node_modules/@edx/eslint-config": { "version": "4.1.0", @@ -6844,9 +6845,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001649", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001649.tgz", - "integrity": "sha512-fJegqZZ0ZX8HOWr6rcafGr72+xcgJKI9oWfDW5DrD7ExUtgZC7a7R7ZYmZqplh7XDocFdGeIFn7roAxhOeYrPQ==", + "version": "1.0.30001690", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001690.tgz", + "integrity": "sha512-5ExiE3qQN6oF8Clf8ifIDcMRCRE/dMGcETG/XGMD8/XiXm6HXQgQTh1yZYLXXpSOsEUlJm1Xr7kGULZTuGtP/w==", "funding": [ { "type": "opencollective", diff --git a/package.json b/package.json index 660acb9a32..6f390e408d 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,7 @@ "videojs-youtube": "3.0.1" }, "devDependencies": { - "@edx/browserslist-config": "1.1.1", + "@edx/browserslist-config": "1.4.0", "@edx/typescript-config": "1.1.0", "@faker-js/faker": "8.4.1", "@openedx/frontend-build": "14.0.14", diff --git a/src/components/app/data/constants.js b/src/components/app/data/constants.js index 3d0925e322..6848604409 100644 --- a/src/components/app/data/constants.js +++ b/src/components/app/data/constants.js @@ -1,3 +1,4 @@ +import _cloneDeep from 'lodash.clonedeep'; import { LICENSE_STATUS } from '../../enterprise-user-subsidy/data/constants'; export const emptyRedeemableLearnerCreditPolicies = { @@ -84,7 +85,7 @@ export const getBaseSubscriptionsData = () => { customerAgreement: null, subscriptionLicense: null, subscriptionPlan: null, - licensesByStatus: structuredClone(baseLicensesByStatus), + licensesByStatus: _cloneDeep(baseLicensesByStatus), showExpirationNotifications: false, }; return { diff --git a/src/components/app/data/services/programs.js b/src/components/app/data/services/programs.js index 90d50588c5..1f47166801 100644 --- a/src/components/app/data/services/programs.js +++ b/src/components/app/data/services/programs.js @@ -2,6 +2,7 @@ import { getConfig } from '@edx/frontend-platform/config'; import { getAuthenticatedHttpClient } from '@edx/frontend-platform/auth'; import { camelCaseObject } from '@edx/frontend-platform/utils'; import { logError } from '@edx/frontend-platform/logging'; +import _cloneDeep from 'lodash.clonedeep'; import { fetchEnterpriseCustomerContainsContent } from './content'; import { getAvailableCourseRuns } from '../utils'; @@ -52,7 +53,7 @@ export async function fetchProgramDetails(enterpriseUuid, programUuid) { if (!programDetails) { return null; } - const programDetailsCopy = structuredClone(programDetails); + const programDetailsCopy = _cloneDeep(programDetails); const { courses } = programDetailsCopy; // Retrieve course keys const courseKeys = courses.map(({ key }) => key);