Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/strict-eyes-grow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@medusajs/dashboard": patch
---

fix(dashboard): fix toggeable number cell set value
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ function setValueToggleableNumber(
const currentValue = field
.split(".")
.reduce((obj, key) => obj?.[key], currentValues)
const { disabledToggle } = currentValue
const { disabledToggle } = currentValue || {}

const normalizeQuantity = (value: number | string | null | undefined) => {
if (disabledToggle && value === "") {
Expand All @@ -196,9 +196,10 @@ function setValueToggleableNumber(
fieldParts.reduce((curr, key: string, index) => {
if (index === fieldParts.length - 1) {
curr[key] = {
...currentValues,
...(currentValue || {}),
quantity,
checked,
disabledToggle: disabledToggle ?? false,
}
}
curr[key] ??= {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ export const InventoryStockForm = ({
const { setCloseOnEscape, handleSuccess } = useRouteModal()

const initialValues = useRef(getDefaultValues(items, locations))
console.log("initialValues", initialValues.current)

const form = useForm<InventoryStockSchema>({
defaultValues: getDefaultValues(items, locations),
Expand Down