fix(dashboard): Persist variant_rank (#11074)

**What**
- Sends variant_rank to the backend
- Sorts variant table by variant_rank if no other order is selected.

We have a project planned for implementing variant_rank correctly, and adding UI for managing the rank after product creation. This PR handles none of that, as it should be handled as part of said project. This PR simply makes the field useable until then.

Resolves CMRC-859
This commit is contained in:
Kasper Fabricius Kristensen authored and GitHub committed 2025-01-22 10:32:24 +00:00
1 parent 9472a825b5
commit c400719fcc
4 files changed
+9 -1

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
---
"@medusajs/dashboard": patch
---
fix(dashboard): Persist variant_rank
@@ -453,6 +453,7 @@ export const ProductCreateVariantsSection = ({
>
<div>
<Checkbox
className="relative"
checked={getCheckboxState(watchedVariants)}
onCheckedChange={onCheckboxChange}
/>
@@ -493,6 +494,7 @@ export const ProductCreateVariantsSection = ({
<Form.Item>
<Form.Control>
<Checkbox
className="relative"
{...field}
checked={value}
onCheckedChange={onChange}
@@ -58,6 +58,7 @@ export const normalizeVariants = (
sku: variant.sku || undefined,
manage_inventory: !!variant.manage_inventory,
allow_backorder: !!variant.allow_backorder,
variant_rank: variant.variant_rank,
inventory_items: variant
.inventory!.map((i) => {
const quantity = i.required_quantity
@@ -64,7 +64,7 @@ export const ProductVariantSection = ({
product.id,
{
q,
order,
order: order ? order : "variant_rank",
offset: offset ? parseInt(offset) : undefined,
limit: PAGE_SIZE,
allow_backorder: allow_backorder