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
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const inventoryDetailQuery = (id: string) => ({
queryFn: async () =>
sdk.admin.inventoryItem.retrieve(id, {
fields: INVENTORY_DETAIL_FIELDS,
order: "-created_at",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Order parameter added to detail query instead of list

Medium Severity

The order: "-created_at" parameter is added to inventoryDetailQuery, which calls sdk.admin.inventoryItem.retrieve(id, ...) — a single-item retrieval endpoint. Ordering is meaningless when fetching one item by ID. The PR intends to change the default sort order of the inventory list, but the inventory list table (in inventory-list-table.tsx) is untouched. This change has no user-visible effect and the actual intended inventory list ordering fix is missing.

Fix in Cursor Fix in Web

}),
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ const productsListQuery = () => ({
limit: 20,
offset: 0,
is_giftcard: false,
order: "-created_at",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Loader query key mismatches component query key causing flicker

Medium Severity

The loader now pre-fetches with order: "-created_at", but the actual product list table component (product-list-table.tsx) calls useProducts with query params from useProductTableQuery, which defaults order to undefined when there's no URL parameter. This creates a query key mismatch: the loader caches under a key containing order: "-created_at", while the component queries under a different key without order. The loader's initialData (sorted descending) briefly displays, then gets replaced by a background refetch using the default ascending order — resulting in a visible flicker and the intended sort order not persisting.

Fix in Cursor Fix in Web

}),
queryFn: async () =>
sdk.admin.product.list({ limit: 20, offset: 0, is_giftcard: false }),
sdk.admin.product.list({ limit: 20, offset: 0, order: "-created_at", is_giftcard: false }),
})

export const productsLoader = (client: QueryClient) => {
Expand Down