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:
@@ -14,7 +14,6 @@ export const useCustomerTableFilters = (
|
||||
const { customer_groups } = useCustomerGroups(
|
||||
{
|
||||
limit: 1000,
|
||||
expand: "",
|
||||
},
|
||||
{
|
||||
enabled: !isGroupsExcluded,
|
||||
|
||||
@@ -10,13 +10,11 @@ export const useOrderTableFilters = (): Filter[] => {
|
||||
const { regions } = useRegions({
|
||||
limit: 1000,
|
||||
fields: "id,name",
|
||||
expand: "",
|
||||
})
|
||||
|
||||
const { sales_channels } = useSalesChannels({
|
||||
limit: 1000,
|
||||
fields: "id,name",
|
||||
expand: "",
|
||||
})
|
||||
|
||||
let filters: Filter[] = []
|
||||
|
||||
+2
-3
@@ -18,7 +18,7 @@ type CustomerGeneralSectionProps = {
|
||||
}
|
||||
|
||||
const PAGE_SIZE = 10
|
||||
const DEFAULT_RELATIONS = "customer,items,sales_channel"
|
||||
const DEFAULT_RELATIONS = "*customer,*items,*sales_channel"
|
||||
const DEFAULT_FIELDS =
|
||||
"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(
|
||||
{
|
||||
customer_id: customer.id,
|
||||
expand: DEFAULT_RELATIONS,
|
||||
fields: DEFAULT_FIELDS,
|
||||
fields: DEFAULT_FIELDS + "," + DEFAULT_RELATIONS,
|
||||
...searchParams,
|
||||
},
|
||||
{
|
||||
|
||||
+3
-1
@@ -10,6 +10,7 @@ import { AdminOrder } from "@medusajs/types"
|
||||
import { useTranslation } from "react-i18next"
|
||||
import { Skeleton } from "../../../../../components/common/skeleton"
|
||||
import { useDate } from "../../../../../hooks/use-date"
|
||||
import { useStockLocation } from "../../../../../hooks/api/stock-locations"
|
||||
|
||||
type OrderTimelineProps = {
|
||||
order: AdminOrder
|
||||
@@ -365,8 +366,9 @@ const FulfillmentCreatedBody = ({
|
||||
}) => {
|
||||
const { t } = useTranslation()
|
||||
|
||||
const { stock_location, isLoading, isError, error } = useAdminStockLocation(
|
||||
const { stock_location, isLoading, isError, error } = useStockLocation(
|
||||
fulfillment.location_id!,
|
||||
undefined,
|
||||
{
|
||||
enabled: !!fulfillment.location_id,
|
||||
}
|
||||
|
||||
+1
@@ -167,6 +167,7 @@ const Fulfillment = ({
|
||||
|
||||
const { stock_location, isError, error } = useStockLocation(
|
||||
fulfillment.location_id!,
|
||||
undefined,
|
||||
{
|
||||
enabled: showLocation,
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { LoaderFunctionArgs } from "react-router-dom"
|
||||
|
||||
import { ordersQueryKeys } from "../../../hooks/api/orders"
|
||||
import { client } from "../../../lib/client"
|
||||
import { sdk } from "../../../lib/client"
|
||||
import { queryClient } from "../../../lib/query-client"
|
||||
import { OrderRes } from "../../../types/api-responses"
|
||||
import { DEFAULT_FIELDS } from "./constants"
|
||||
@@ -9,7 +9,7 @@ import { DEFAULT_FIELDS } from "./constants"
|
||||
const orderDetailQuery = (id: string) => ({
|
||||
queryKey: ordersQueryKeys.detail(id),
|
||||
queryFn: async () =>
|
||||
client.orders.retrieve(id, {
|
||||
sdk.admin.order.retrieve(id, {
|
||||
fields: DEFAULT_FIELDS,
|
||||
}),
|
||||
})
|
||||
|
||||
+1
-1
@@ -75,7 +75,7 @@ export const AddProductsToSalesChannelForm = ({
|
||||
error,
|
||||
} = useProducts(
|
||||
{
|
||||
expand: "variants,sales_channels",
|
||||
fields: "*variants,*sales_channels",
|
||||
...searchParams,
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user