chore(): Remove lodash.set entirely (#14041)
* chore(): Remove lodash.set entirely * Create dull-balloons-sneeze.md * chore(): Remove lodash.set entirely * chore(): Remove lodash.set entirely
This commit is contained in:
committed by
GitHub
parent
b49a4451f0
commit
657a16c462
5
.changeset/dull-balloons-sneeze.md
Normal file
5
.changeset/dull-balloons-sneeze.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@medusajs/dashboard": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
chore(): Remove lodash.set entirely
|
||||||
@@ -64,7 +64,6 @@
|
|||||||
"i18next-http-backend": "2.4.2",
|
"i18next-http-backend": "2.4.2",
|
||||||
"lodash.debounce": "^4.0.8",
|
"lodash.debounce": "^4.0.8",
|
||||||
"lodash.isequal": "^4.5.0",
|
"lodash.isequal": "^4.5.0",
|
||||||
"lodash.set": "^4.3.2",
|
|
||||||
"match-sorter": "^6.3.4",
|
"match-sorter": "^6.3.4",
|
||||||
"motion": "^11.15.0",
|
"motion": "^11.15.0",
|
||||||
"qs": "^6.12.1",
|
"qs": "^6.12.1",
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import set from "lodash.set"
|
|
||||||
import { useCallback } from "react"
|
import { useCallback } from "react"
|
||||||
import { FieldValues, Path, PathValue, UseFormReturn } from "react-hook-form"
|
import { FieldValues, Path, PathValue, UseFormReturn } from "react-hook-form"
|
||||||
|
|
||||||
@@ -17,7 +16,7 @@ type UseDataGridFormHandlersOptions<TData, TFieldValues extends FieldValues> = {
|
|||||||
|
|
||||||
export const useDataGridFormHandlers = <
|
export const useDataGridFormHandlers = <
|
||||||
TData,
|
TData,
|
||||||
TFieldValues extends FieldValues,
|
TFieldValues extends FieldValues
|
||||||
>({
|
>({
|
||||||
matrix,
|
matrix,
|
||||||
form,
|
form,
|
||||||
@@ -139,7 +138,7 @@ function convertToggleableNumber(value: any): {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function setValue<
|
function setValue<
|
||||||
T extends DataGridToggleableNumber = DataGridToggleableNumber,
|
T extends DataGridToggleableNumber = DataGridToggleableNumber
|
||||||
>(
|
>(
|
||||||
currentValues: any,
|
currentValues: any,
|
||||||
field: string,
|
field: string,
|
||||||
@@ -148,7 +147,13 @@ function setValue<
|
|||||||
isHistory?: boolean
|
isHistory?: boolean
|
||||||
) {
|
) {
|
||||||
if (type !== "togglable-number") {
|
if (type !== "togglable-number") {
|
||||||
set(currentValues, field, newValue)
|
field.split(".").reduce((curr, key, index) => {
|
||||||
|
if (index === field.split(".").length - 1) {
|
||||||
|
curr[key] = newValue
|
||||||
|
}
|
||||||
|
curr[key] ??= {}
|
||||||
|
return curr[key]
|
||||||
|
}, currentValues)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -187,11 +192,18 @@ function setValueToggleableNumber(
|
|||||||
: newValue.checked
|
: newValue.checked
|
||||||
: determineChecked(quantity)
|
: determineChecked(quantity)
|
||||||
|
|
||||||
set(currentValues, field, {
|
const fieldParts = field.split(".")
|
||||||
...currentValue,
|
fieldParts.reduce((curr, key: string, index) => {
|
||||||
quantity,
|
if (index === fieldParts.length - 1) {
|
||||||
checked,
|
curr[key] = {
|
||||||
})
|
...currentValues,
|
||||||
|
quantity,
|
||||||
|
checked,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
curr[key] ??= {}
|
||||||
|
return curr[key]
|
||||||
|
}, currentValues)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function convertArrayToPrimitive(
|
export function convertArrayToPrimitive(
|
||||||
|
|||||||
@@ -3423,7 +3423,6 @@ __metadata:
|
|||||||
i18next-http-backend: 2.4.2
|
i18next-http-backend: 2.4.2
|
||||||
lodash.debounce: ^4.0.8
|
lodash.debounce: ^4.0.8
|
||||||
lodash.isequal: ^4.5.0
|
lodash.isequal: ^4.5.0
|
||||||
lodash.set: ^4.3.2
|
|
||||||
match-sorter: ^6.3.4
|
match-sorter: ^6.3.4
|
||||||
motion: ^11.15.0
|
motion: ^11.15.0
|
||||||
qs: ^6.12.1
|
qs: ^6.12.1
|
||||||
@@ -20385,13 +20384,6 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"lodash.set@npm:^4.3.2":
|
|
||||||
version: 4.3.2
|
|
||||||
resolution: "lodash.set@npm:4.3.2"
|
|
||||||
checksum: c641d31905e51df43170dce8a1d11a1cff11356e2e2e75fe2615995408e9687d58c3e1d64c3c284c2df2bc519f79a98af737d2944d382ff82ffd244ff6075c29
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"lodash.sortby@npm:^4.7.0":
|
"lodash.sortby@npm:^4.7.0":
|
||||||
version: 4.7.0
|
version: 4.7.0
|
||||||
resolution: "lodash.sortby@npm:4.7.0"
|
resolution: "lodash.sortby@npm:4.7.0"
|
||||||
|
|||||||
Reference in New Issue
Block a user