Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Fixed: use `limit` not `per_page` in Admin SPA API calls

Damian Legawiec9972f89c63ee
diff --git a/packages/admin/src/hooks/use-custom-fields.ts b/packages/admin/src/hooks/use-custom-fields.ts
index ac81254ed7..75815c3a39 100644
--- a/packages/admin/src/hooks/use-custom-fields.ts
+++ b/packages/admin/src/hooks/use-custom-fields.ts
@@ -16,7 +16,7 @@ const definitionsKey = (resourceType: string) => ['custom-field-definitions', re
export function useCustomFields(ownerType: CustomFieldOwnerType, ownerId: string) {
return useQuery({
queryKey: valuesKey(ownerType, ownerId),
- queryFn: () => adminClient.customFields(ownerType, ownerId).list({ per_page: 100 }),
+ queryFn: () => adminClient.customFields(ownerType, ownerId).list({ limit: 100 }),
enabled: !!ownerId,
})
}
@@ -26,7 +26,7 @@ export function useCustomFieldDefinitions(resourceType: string) {
queryKey: definitionsKey(resourceType),
queryFn: () =>
adminClient.customFieldDefinitions.list({
- per_page: 100,
+ limit: 100,
resource_type_eq: resourceType,
}),
enabled: !!resourceType,
diff --git a/packages/admin/src/routes/_authenticated/$storeId/customers/$customerId.tsx b/packages/admin/src/routes/_authenticated/$storeId/customers/$customerId.tsx
index a56184cd0e..e636800667 100644
--- a/packages/admin/src/routes/_authenticated/$storeId/customers/$customerId.tsx
+++ b/packages/admin/src/routes/_authenticated/$storeId/customers/$customerId.tsx
@@ -335,7 +335,7 @@ function useCustomerOrders(customerId: string, params: { limit: number; status?:
queryFn: () =>
adminClient.orders.list({
q: { user_id_eq: customerId, ...(params.status ? { status_eq: params.status } : {}) },
- per_page: params.limit,
+ limit: params.limit,
sort: '-completed_at',
expand: ['items'],
}),