diff --git a/client/package.json b/client/package.json index 9cfb1ed1e5..4f6b63d86c 100644 --- a/client/package.json +++ b/client/package.json @@ -82,6 +82,7 @@ "@types/node": "16.11.6", "@types/react": "18.2.28", "@types/react-dom": "18.2.13", + "@types/uuid": "^9.0.5", "@typescript-eslint/eslint-plugin": "6.8.0", "@typescript-eslint/parser": "6.8.0", "cypress": "13.2.0", diff --git a/client/src/hooks/sourcing-locations/index.ts b/client/src/hooks/sourcing-locations/index.ts index 4d99bc70d5..2938ce4514 100644 --- a/client/src/hooks/sourcing-locations/index.ts +++ b/client/src/hooks/sourcing-locations/index.ts @@ -1,6 +1,7 @@ import { useMemo } from 'react'; import { useQuery } from '@tanstack/react-query'; import { merge } from 'lodash-es'; +import { v4 as uuidv4 } from 'uuid'; import apiService from 'services/api'; @@ -91,7 +92,7 @@ export function useSourcingLocationsMaterials( // duplicate rows when updating the table data. A workaround is to generate uuids. // We won't be loading many rows at once so it shouldn't be a huge performance hit. ((response as SourcingLocationsMaterialsAPIResponse).data || []).map((data) => ({ - // id: uuidv4(), + id: uuidv4(), ...data, })) || [], meta: (response as SourcingLocationsMaterialsAPIResponse).meta || {}, diff --git a/client/yarn.lock b/client/yarn.lock index 588383850d..da3514f32b 100644 --- a/client/yarn.lock +++ b/client/yarn.lock @@ -1819,6 +1819,13 @@ __metadata: languageName: node linkType: hard +"@types/uuid@npm:^9.0.5": + version: 9.0.5 + resolution: "@types/uuid@npm:9.0.5" + checksum: 7577940949619768303c0bf0a7cc235fac3cfae1c0bb4a2e85bfb87b2eb1024955ab446f775394d259442cd769b663b6ce43c39bdfc955d946bf833804ddb421 + languageName: node + linkType: hard + "@types/yauzl@npm:^2.9.1": version: 2.10.0 resolution: "@types/yauzl@npm:2.10.0" @@ -6273,6 +6280,7 @@ __metadata: "@types/node": 16.11.6 "@types/react": 18.2.28 "@types/react-dom": 18.2.13 + "@types/uuid": ^9.0.5 "@typescript-eslint/eslint-plugin": 6.8.0 "@typescript-eslint/parser": 6.8.0 autoprefixer: 10.2.5