Skip to content

Commit

Permalink
assign uuid
Browse files Browse the repository at this point in the history
  • Loading branch information
davidsingal committed Oct 17, 2023
1 parent ef18a10 commit d9e666d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 2 additions & 1 deletion client/src/hooks/sourcing-locations/index.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand Down Expand Up @@ -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 || {},
Expand Down
8 changes: 8 additions & 0 deletions client/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d9e666d

Please sign in to comment.