fix(dashboard): stale params (#7630)
**What** - fix places where we send wrong params (strict validation is now returning 400s for these) - use SDK instead client for order details loader
This commit is contained in:
1 parent
50ce223e4b
commit
e8df2431f8
7 files changed
+9
-10
No files matched your search
@@ -14,7 +14,6 @@ export const useCustomerTableFilters = (
|
|||||||
const { customer_groups } = useCustomerGroups(
|
const { customer_groups } = useCustomerGroups(
|
||||||
{
|
{
|
||||||
limit: 1000,
|
limit: 1000,
|
||||||
expand: "",
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
enabled: !isGroupsExcluded,
|
enabled: !isGroupsExcluded,
|
||||||
|
|||||||
@@ -10,13 +10,11 @@ export const useOrderTableFilters = (): Filter[] => {
|
|||||||
const { regions } = useRegions({
|
const { regions } = useRegions({
|
||||||
limit: 1000,
|
limit: 1000,
|
||||||
fields: "id,name",
|
fields: "id,name",
|
||||||
expand: "",
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const { sales_channels } = useSalesChannels({
|
const { sales_channels } = useSalesChannels({
|
||||||
limit: 1000,
|
limit: 1000,
|
||||||
fields: "id,name",
|
fields: "id,name",
|
||||||
expand: "",
|
|
||||||
})
|
})
|
||||||
|
|
||||||
let filters: Filter[] = []
|
let filters: Filter[] = []
|
||||||
|
|||||||
+2
-3
@@ -18,7 +18,7 @@ type CustomerGeneralSectionProps = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const PAGE_SIZE = 10
|
const PAGE_SIZE = 10
|
||||||
const DEFAULT_RELATIONS = "customer,items,sales_channel"
|
const DEFAULT_RELATIONS = "*customer,*items,*sales_channel"
|
||||||
const DEFAULT_FIELDS =
|
const DEFAULT_FIELDS =
|
||||||
"id,status,display_id,created_at,email,fulfillment_status,payment_status,total,currency_code"
|
"id,status,display_id,created_at,email,fulfillment_status,payment_status,total,currency_code"
|
||||||
|
|
||||||
@@ -33,8 +33,7 @@ export const CustomerOrderSection = ({
|
|||||||
const { orders, count, isLoading, isError, error } = useOrders(
|
const { orders, count, isLoading, isError, error } = useOrders(
|
||||||
{
|
{
|
||||||
customer_id: customer.id,
|
customer_id: customer.id,
|
||||||
expand: DEFAULT_RELATIONS,
|
fields: DEFAULT_FIELDS + "," + DEFAULT_RELATIONS,
|
||||||
fields: DEFAULT_FIELDS,
|
|
||||||
...searchParams,
|
...searchParams,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
+3
-1
@@ -10,6 +10,7 @@ import { AdminOrder } from "@medusajs/types"
|
|||||||
import { useTranslation } from "react-i18next"
|
import { useTranslation } from "react-i18next"
|
||||||
import { Skeleton } from "../../../../../components/common/skeleton"
|
import { Skeleton } from "../../../../../components/common/skeleton"
|
||||||
import { useDate } from "../../../../../hooks/use-date"
|
import { useDate } from "../../../../../hooks/use-date"
|
||||||
|
import { useStockLocation } from "../../../../../hooks/api/stock-locations"
|
||||||
|
|
||||||
type OrderTimelineProps = {
|
type OrderTimelineProps = {
|
||||||
order: AdminOrder
|
order: AdminOrder
|
||||||
@@ -365,8 +366,9 @@ const FulfillmentCreatedBody = ({
|
|||||||
}) => {
|
}) => {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
|
|
||||||
const { stock_location, isLoading, isError, error } = useAdminStockLocation(
|
const { stock_location, isLoading, isError, error } = useStockLocation(
|
||||||
fulfillment.location_id!,
|
fulfillment.location_id!,
|
||||||
|
undefined,
|
||||||
{
|
{
|
||||||
enabled: !!fulfillment.location_id,
|
enabled: !!fulfillment.location_id,
|
||||||
}
|
}
|
||||||
|
|||||||
+1
@@ -167,6 +167,7 @@ const Fulfillment = ({
|
|||||||
|
|
||||||
const { stock_location, isError, error } = useStockLocation(
|
const { stock_location, isError, error } = useStockLocation(
|
||||||
fulfillment.location_id!,
|
fulfillment.location_id!,
|
||||||
|
undefined,
|
||||||
{
|
{
|
||||||
enabled: showLocation,
|
enabled: showLocation,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { LoaderFunctionArgs } from "react-router-dom"
|
import { LoaderFunctionArgs } from "react-router-dom"
|
||||||
|
|
||||||
import { ordersQueryKeys } from "../../../hooks/api/orders"
|
import { ordersQueryKeys } from "../../../hooks/api/orders"
|
||||||
import { client } from "../../../lib/client"
|
import { sdk } from "../../../lib/client"
|
||||||
import { queryClient } from "../../../lib/query-client"
|
import { queryClient } from "../../../lib/query-client"
|
||||||
import { OrderRes } from "../../../types/api-responses"
|
import { OrderRes } from "../../../types/api-responses"
|
||||||
import { DEFAULT_FIELDS } from "./constants"
|
import { DEFAULT_FIELDS } from "./constants"
|
||||||
@@ -9,7 +9,7 @@ import { DEFAULT_FIELDS } from "./constants"
|
|||||||
const orderDetailQuery = (id: string) => ({
|
const orderDetailQuery = (id: string) => ({
|
||||||
queryKey: ordersQueryKeys.detail(id),
|
queryKey: ordersQueryKeys.detail(id),
|
||||||
queryFn: async () =>
|
queryFn: async () =>
|
||||||
client.orders.retrieve(id, {
|
sdk.admin.order.retrieve(id, {
|
||||||
fields: DEFAULT_FIELDS,
|
fields: DEFAULT_FIELDS,
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
|
|||||||
+1
-1
@@ -75,7 +75,7 @@ export const AddProductsToSalesChannelForm = ({
|
|||||||
error,
|
error,
|
||||||
} = useProducts(
|
} = useProducts(
|
||||||
{
|
{
|
||||||
expand: "variants,sales_channels",
|
fields: "*variants,*sales_channels",
|
||||||
...searchParams,
|
...searchParams,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user