Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
1271128
update package.json react query v5
kevinxh Mar 7, 2025
da598a9
update lock files
kevinxh Mar 7, 2025
54f61e1
update react query 5 signatures and types
kevinxh Mar 7, 2025
48c3070
fix type errors
kevinxh Mar 7, 2025
3d3cd8c
update changelog
kevinxh Mar 7, 2025
27eddf2
empty commit
kevinxh Mar 7, 2025
818d494
temporarily comment out peer deps
kevinxh Mar 11, 2025
1d1c165
temporarily ignore some ts error
kevinxh Mar 11, 2025
bbbfda5
fix test
kevinxh Mar 11, 2025
d4b66ff
fix lint errors
kevinxh Mar 11, 2025
6c5ffe9
update react-query v5 Hydrate component
kevinxh Mar 11, 2025
df28643
remove server retry handling
kevinxh Mar 11, 2025
4a0d936
update readme
kevinxh Mar 11, 2025
0908080
trigger ci
kevinxh Mar 11, 2025
de0e7b4
fix useQuery usage in test
kevinxh Mar 11, 2025
5ef692b
lint
kevinxh Mar 11, 2025
989cbf8
migrate UnavailableProductConfirmationModal onSuccess to useEffect
kevinxh Mar 11, 2025
52db136
update useEffect dependent list
kevinxh Mar 11, 2025
850e678
convert useWishList query onSuccess
kevinxh Mar 11, 2025
d4b2883
convert useShippingMethod query
kevinxh Mar 11, 2025
41f5f41
ensure callback happens when query is success
kevinxh Mar 11, 2025
9d1b9de
convert useProductViewModal
kevinxh Mar 11, 2025
85f74ba
update useEffect dependent list
kevinxh Mar 11, 2025
8c82322
replace keepPreviousData with placeholderData
kevinxh Mar 11, 2025
3759a0d
use keepPreviousData
kevinxh Mar 11, 2025
c49a78b
fix missing import
kevinxh Mar 11, 2025
f1afa3c
invert if conditions
kevinxh Mar 11, 2025
77f0cf9
keep client side retrys
kevinxh Mar 11, 2025
8ac8d5a
implement resetQueryTimeStamp
kevinxh Mar 11, 2025
7c2796e
use correct type
kevinxh Mar 11, 2025
b391d92
clean up
kevinxh Mar 11, 2025
9fc0d48
use Date type
kevinxh Mar 11, 2025
1e5740e
rename to resetDehydratedQueryTimeStamp
kevinxh Mar 11, 2025
34f33db
rename resetDehydratedStateTimeStamp
kevinxh Mar 11, 2025
9c15553
regenerate lock files
kevinxh Mar 12, 2025
d5f0b67
Merge pull request #2309 from SalesforceCommerceCloud/feature/react-q…
kevinxh Mar 12, 2025
70bb253
Merge pull request #2310 from SalesforceCommerceCloud/feature/react-q…
kevinxh Mar 12, 2025
7bc7410
Merge pull request #2311 from SalesforceCommerceCloud/feature/react-q…
kevinxh Mar 12, 2025
91bf448
Merge pull request #2312 from SalesforceCommerceCloud/feature/react-q…
kevinxh Mar 12, 2025
cc66573
update package-lock
kevinxh Mar 12, 2025
5e90a94
Merge branch 'feature/react-query-5-basics' of https://github.com/Sal…
kevinxh Mar 12, 2025
ac25a35
fix test
kevinxh Mar 12, 2025
69d5580
lint
kevinxh Mar 12, 2025
c05b937
fix test
kevinxh Mar 12, 2025
68daa41
fix jest config
kevinxh Mar 12, 2025
1cbea68
convert ref to state
kevinxh Mar 12, 2025
c79d607
remove console logs
kevinxh Mar 12, 2025
0aa24cf
bump commerce-sdk-react version
kevinxh Mar 12, 2025
fd52e61
fix template-retail-react-app test failure
kevinxh Mar 12, 2025
76c92dc
move resetDehydratedStateTimeStamp to utils.ts
kevinxh Mar 13, 2025
aa729dd
add tests
kevinxh Mar 13, 2025
3f69f15
fix test
kevinxh Mar 13, 2025
6a6a463
lint
kevinxh Mar 13, 2025
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
1,232 changes: 1,051 additions & 181 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions packages/commerce-sdk-react/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## v4.0.0-dev (Mar 07, 2025)
- Upgrade `@tanstack/react-query` to v5 [#2303](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/2303)

## v3.2.0-extensibility-preview.4 (Feb 12, 2025)
- Add `ServerContext` type for `useServerContext` hook [#2239](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/2239)

Expand Down
492 changes: 368 additions & 124 deletions packages/commerce-sdk-react/package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions packages/commerce-sdk-react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@salesforce/commerce-sdk-react",
"version": "3.2.0-extensibility-preview.4",
"version": "4.0.0-extensibility-preview.1",
"description": "A library that provides react hooks for fetching data from Commerce Cloud",
"homepage": "https://github.com/SalesforceCommerceCloud/pwa-kit/tree/develop/packages/ecom-react-hooks#readme",
"bugs": {
Expand Down Expand Up @@ -46,7 +46,7 @@
},
"devDependencies": {
"@salesforce/pwa-kit-dev": "4.0.0-extensibility-preview.4",
"@tanstack/react-query": "^4.28.0",
"@tanstack/react-query": "^5.67.1",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^14.0.0",
"@testing-library/user-event": "^14.4.3",
Expand Down Expand Up @@ -75,7 +75,7 @@
"typescript": "4.9.5"
},
"peerDependencies": {
"@tanstack/react-query": "^4.28.0",
"@tanstack/react-query": "^5.67.1",
"react": "^18.2.0",
"react-helmet": "^6.1.0"
},
Expand Down
16 changes: 11 additions & 5 deletions packages/commerce-sdk-react/src/hooks/ShopperBaskets/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* SPDX-License-Identifier: BSD-3-Clause
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
/* eslint-disable @typescript-eslint/ban-ts-comment */
import {UseQueryResult} from '@tanstack/react-query'
import {ApiClients, ApiQueryOptions, Argument, DataType, NullableParameters} from '../types'
import useCommerceApi from '../useCommerceApi'
Expand All @@ -28,7 +29,7 @@ type Client = ApiClients['shopperBaskets']
export const useBasket = (
apiOptions: NullableParameters<Argument<Client['getBasket']>>,
queryOptions: ApiQueryOptions<Client['getBasket']> = {}
): UseQueryResult<DataType<Client['getBasket']>> => {
): UseQueryResult<DataType<Client['getBasket']>, Error> => {
type Options = Argument<Client['getBasket']>
type Data = DataType<Client['getBasket']>
const {shopperBaskets: client} = useCommerceApi()
Expand All @@ -50,6 +51,7 @@ export const useBasket = (

// For some reason, if we don't explicitly set these generic parameters, the inferred type for
// `Data` sometimes, but not always, includes `Response`, which is incorrect. I don't know why.
// @ts-ignore Fix
Copy link
Contributor Author

@kevinxh kevinxh Mar 11, 2025

Choose a reason for hiding this comment

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

The new react-query v5 had a MAJOR overhaul of its type definitions, including removing of tons of overloads.

Now, only one function signature type is available, which is a super good news for us, because in the past, we've had issues to create types that satisfy all of the overloads. This was a major blocker for us creating a DRY implementation, and we had to duplicate the implementation for every Shopper api.

I'm going to create a new ticket to re-implement the useQuery and useMutation typings and hopefully we can use generics to DRY the implementation.

This would also drastically decrease the bundle size.

Ticket to be created.

return useQuery<Client, Options, Data>({...netOptions, parameters}, queryOptions, {
method,
queryKey,
Expand All @@ -70,7 +72,7 @@ export const useBasket = (
export const usePaymentMethodsForBasket = (
apiOptions: NullableParameters<Argument<Client['getPaymentMethodsForBasket']>>,
queryOptions: ApiQueryOptions<Client['getPaymentMethodsForBasket']> = {}
): UseQueryResult<DataType<Client['getPaymentMethodsForBasket']>> => {
): UseQueryResult<DataType<Client['getPaymentMethodsForBasket']>, Error> => {
type Options = Argument<Client['getPaymentMethodsForBasket']>
type Data = DataType<Client['getPaymentMethodsForBasket']>
const {shopperBaskets: client} = useCommerceApi()
Expand All @@ -92,6 +94,7 @@ export const usePaymentMethodsForBasket = (

// For some reason, if we don't explicitly set these generic parameters, the inferred type for
// `Data` sometimes, but not always, includes `Response`, which is incorrect. I don't know why.
// @ts-ignore TODO: Fix react query result error generics
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the reason we have having this issue? Is you plan to ignore it or will this be fixed in this PR. Or will it be fixed in the refactor ticket you mentioned in a previous comment.

return useQuery<Client, Options, Data>({...netOptions, parameters}, queryOptions, {
method,
queryKey,
Expand All @@ -112,7 +115,7 @@ export const usePaymentMethodsForBasket = (
export const usePriceBooksForBasket = (
apiOptions: NullableParameters<Argument<Client['getPriceBooksForBasket']>>,
queryOptions: ApiQueryOptions<Client['getPriceBooksForBasket']> = {}
): UseQueryResult<DataType<Client['getPriceBooksForBasket']>> => {
): UseQueryResult<DataType<Client['getPriceBooksForBasket']>, Error> => {
type Options = Argument<Client['getPriceBooksForBasket']>
type Data = DataType<Client['getPriceBooksForBasket']>
const {shopperBaskets: client} = useCommerceApi()
Expand All @@ -134,6 +137,7 @@ export const usePriceBooksForBasket = (

// For some reason, if we don't explicitly set these generic parameters, the inferred type for
// `Data` sometimes, but not always, includes `Response`, which is incorrect. I don't know why.
// @ts-ignore TODO: Fix react query result error generics
return useQuery<Client, Options, Data>({...netOptions, parameters}, queryOptions, {
method,
queryKey,
Expand All @@ -154,7 +158,7 @@ export const usePriceBooksForBasket = (
export const useShippingMethodsForShipment = (
apiOptions: NullableParameters<Argument<Client['getShippingMethodsForShipment']>>,
queryOptions: ApiQueryOptions<Client['getShippingMethodsForShipment']> = {}
): UseQueryResult<DataType<Client['getShippingMethodsForShipment']>> => {
): UseQueryResult<DataType<Client['getShippingMethodsForShipment']>, Error> => {
type Options = Argument<Client['getShippingMethodsForShipment']>
type Data = DataType<Client['getShippingMethodsForShipment']>
const {shopperBaskets: client} = useCommerceApi()
Expand All @@ -176,6 +180,7 @@ export const useShippingMethodsForShipment = (

// For some reason, if we don't explicitly set these generic parameters, the inferred type for
// `Data` sometimes, but not always, includes `Response`, which is incorrect. I don't know why.
// @ts-ignore TODO: Fix react query result error generics
return useQuery<Client, Options, Data>({...netOptions, parameters}, queryOptions, {
method,
queryKey,
Expand All @@ -196,7 +201,7 @@ export const useShippingMethodsForShipment = (
export const useTaxesFromBasket = (
apiOptions: NullableParameters<Argument<Client['getTaxesFromBasket']>>,
queryOptions: ApiQueryOptions<Client['getTaxesFromBasket']> = {}
): UseQueryResult<DataType<Client['getTaxesFromBasket']>> => {
): UseQueryResult<DataType<Client['getTaxesFromBasket']>, Error> => {
type Options = Argument<Client['getTaxesFromBasket']>
type Data = DataType<Client['getTaxesFromBasket']>
const {shopperBaskets: client} = useCommerceApi()
Expand All @@ -218,6 +223,7 @@ export const useTaxesFromBasket = (

// For some reason, if we don't explicitly set these generic parameters, the inferred type for
// `Data` sometimes, but not always, includes `Response`, which is incorrect. I don't know why.
// @ts-ignore TODO: Fix react query result error generics
return useQuery<Client, Options, Data>({...netOptions, parameters}, queryOptions, {
method,
queryKey,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* SPDX-License-Identifier: BSD-3-Clause
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
/* eslint-disable @typescript-eslint/ban-ts-comment */
import {UseQueryResult} from '@tanstack/react-query'
import {ApiClients, ApiQueryOptions, Argument, DataType, NullableParameters} from '../types'
import useCommerceApi from '../useCommerceApi'
Expand All @@ -28,7 +29,7 @@ type Client = ApiClients['shopperContexts']
export const useShopperContext = (
apiOptions: NullableParameters<Argument<Client['getShopperContext']>>,
queryOptions: ApiQueryOptions<Client['getShopperContext']> = {}
): UseQueryResult<DataType<Client['getShopperContext']>> => {
): UseQueryResult<DataType<Client['getShopperContext']>, Error> => {
type Options = Argument<Client['getShopperContext']>
type Data = DataType<Client['getShopperContext']>
const {shopperContexts: client} = useCommerceApi()
Expand All @@ -51,6 +52,7 @@ export const useShopperContext = (

// For some reason, if we don't explicitly set these generic parameters, the inferred type for
// `Data` sometimes, but not always, includes `Response`, which is incorrect. I don't know why.
// @ts-ignore TODO: Fix react query result error generics
return useQuery<Client, Options, Data>({...netOptions, parameters}, queryOptions, {
method,
queryKey,
Expand Down
34 changes: 23 additions & 11 deletions packages/commerce-sdk-react/src/hooks/ShopperCustomers/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* SPDX-License-Identifier: BSD-3-Clause
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
/* eslint-disable @typescript-eslint/ban-ts-comment */
import {UseQueryResult} from '@tanstack/react-query'
import {ShopperCustomers} from 'commerce-sdk-isomorphic'
import {ApiClients, ApiQueryOptions, Argument, DataType, NullableParameters} from '../types'
Expand Down Expand Up @@ -65,7 +66,7 @@ type Client = ApiClients['shopperCustomers']
export const useCustomer = (
apiOptions: NullableParameters<Argument<Client['getCustomer']>>,
queryOptions: ApiQueryOptions<Client['getCustomer']> = {}
): UseQueryResult<DataType<Client['getCustomer']>> => {
): UseQueryResult<DataType<Client['getCustomer']>, Error> => {
type Options = Argument<Client['getCustomer']>
type Data = DataType<Client['getCustomer']>
const {shopperCustomers: client} = useCommerceApi()
Expand All @@ -88,6 +89,7 @@ export const useCustomer = (

// For some reason, if we don't explicitly set these generic parameters, the inferred type for
// `Data` sometimes, but not always, includes `Response`, which is incorrect. I don't know why.
// @ts-ignore TODO: Fix react query result error generics
return useQuery<Client, Options, Data>({...netOptions, parameters}, queryOptions, {
method,
queryKey,
Expand All @@ -108,7 +110,7 @@ export const useCustomer = (
export const useCustomerAddress = (
apiOptions: NullableParameters<Argument<Client['getCustomerAddress']>>,
queryOptions: ApiQueryOptions<Client['getCustomerAddress']> = {}
): UseQueryResult<DataType<Client['getCustomerAddress']>> => {
): UseQueryResult<DataType<Client['getCustomerAddress']>, Error> => {
type Options = Argument<Client['getCustomerAddress']>
type Data = DataType<Client['getCustomerAddress']>
const {shopperCustomers: client} = useCommerceApi()
Expand All @@ -133,6 +135,7 @@ export const useCustomerAddress = (

// For some reason, if we don't explicitly set these generic parameters, the inferred type for
// `Data` sometimes, but not always, includes `Response`, which is incorrect. I don't know why.
// @ts-ignore TODO: Fix react query result error generics
return useQuery<Client, Options, Data>({...netOptions, parameters}, queryOptions, {
method,
queryKey,
Expand All @@ -153,7 +156,7 @@ export const useCustomerAddress = (
export const useCustomerBaskets = (
apiOptions: NullableParameters<Argument<Client['getCustomerBaskets']>>,
queryOptions: ApiQueryOptions<Client['getCustomerBaskets']> = {}
): UseQueryResult<DataType<Client['getCustomerBaskets']>> => {
): UseQueryResult<DataType<Client['getCustomerBaskets']>, Error> => {
type Options = Argument<Client['getCustomerBaskets']>
type Data = DataType<Client['getCustomerBaskets']>
const {shopperCustomers: client} = useCommerceApi()
Expand All @@ -178,6 +181,7 @@ export const useCustomerBaskets = (

// For some reason, if we don't explicitly set these generic parameters, the inferred type for
// `Data` sometimes, but not always, includes `Response`, which is incorrect. I don't know why.
// @ts-ignore TODO: Fix react query result error generics
return useQuery<Client, Options, Data>({...netOptions, parameters}, queryOptions, {
method,
queryKey,
Expand All @@ -200,7 +204,7 @@ export const useCustomerBaskets = (
export const useCustomerOrders = (
apiOptions: NullableParameters<Argument<Client['getCustomerOrders']>>,
queryOptions: ApiQueryOptions<Client['getCustomerOrders']> = {}
): UseQueryResult<DataType<Client['getCustomerOrders']>> => {
): UseQueryResult<DataType<Client['getCustomerOrders']>, Error> => {
type Options = Argument<Client['getCustomerOrders']>
type Data = DataType<Client['getCustomerOrders']>
const {shopperCustomers: client} = useCommerceApi()
Expand All @@ -225,6 +229,7 @@ export const useCustomerOrders = (

// For some reason, if we don't explicitly set these generic parameters, the inferred type for
// `Data` sometimes, but not always, includes `Response`, which is incorrect. I don't know why.
// @ts-ignore TODO: Fix react query result error generics
return useQuery<Client, Options, Data>({...netOptions, parameters}, queryOptions, {
method,
queryKey,
Expand All @@ -245,7 +250,7 @@ export const useCustomerOrders = (
export const useCustomerPaymentInstrument = (
apiOptions: NullableParameters<Argument<Client['getCustomerPaymentInstrument']>>,
queryOptions: ApiQueryOptions<Client['getCustomerPaymentInstrument']> = {}
): UseQueryResult<DataType<Client['getCustomerPaymentInstrument']>> => {
): UseQueryResult<DataType<Client['getCustomerPaymentInstrument']>, Error> => {
type Options = Argument<Client['getCustomerPaymentInstrument']>
type Data = DataType<Client['getCustomerPaymentInstrument']>
const {shopperCustomers: client} = useCommerceApi()
Expand All @@ -270,6 +275,7 @@ export const useCustomerPaymentInstrument = (

// For some reason, if we don't explicitly set these generic parameters, the inferred type for
// `Data` sometimes, but not always, includes `Response`, which is incorrect. I don't know why.
// @ts-ignore TODO: Fix react query result error generics
return useQuery<Client, Options, Data>({...netOptions, parameters}, queryOptions, {
method,
queryKey,
Expand All @@ -290,7 +296,7 @@ export const useCustomerPaymentInstrument = (
export const useCustomerProductLists = (
apiOptions: NullableParameters<Argument<Client['getCustomerProductLists']>>,
queryOptions: ApiQueryOptions<Client['getCustomerProductLists']> = {}
): UseQueryResult<DataType<Client['getCustomerProductLists']>> => {
): UseQueryResult<DataType<Client['getCustomerProductLists']>, Error> => {
type Options = Argument<Client['getCustomerProductLists']>
type Data = DataType<Client['getCustomerProductLists']>
const {shopperCustomers: client} = useCommerceApi()
Expand All @@ -315,6 +321,7 @@ export const useCustomerProductLists = (

// For some reason, if we don't explicitly set these generic parameters, the inferred type for
// `Data` sometimes, but not always, includes `Response`, which is incorrect. I don't know why.
// @ts-ignore TODO: Fix react query result error generics
return useQuery<Client, Options, Data>({...netOptions, parameters}, queryOptions, {
method,
queryKey,
Expand All @@ -335,7 +342,7 @@ export const useCustomerProductLists = (
export const useCustomerProductList = (
apiOptions: NullableParameters<Argument<Client['getCustomerProductList']>>,
queryOptions: ApiQueryOptions<Client['getCustomerProductList']> = {}
): UseQueryResult<DataType<Client['getCustomerProductList']>> => {
): UseQueryResult<DataType<Client['getCustomerProductList']>, Error> => {
type Options = Argument<Client['getCustomerProductList']>
type Data = DataType<Client['getCustomerProductList']>
const {shopperCustomers: client} = useCommerceApi()
Expand All @@ -360,6 +367,7 @@ export const useCustomerProductList = (

// For some reason, if we don't explicitly set these generic parameters, the inferred type for
// `Data` sometimes, but not always, includes `Response`, which is incorrect. I don't know why.
// @ts-ignore TODO: Fix react query result error generics
return useQuery<Client, Options, Data>({...netOptions, parameters}, queryOptions, {
method,
queryKey,
Expand All @@ -380,7 +388,7 @@ export const useCustomerProductList = (
export const useCustomerProductListItem = (
apiOptions: NullableParameters<Argument<Client['getCustomerProductListItem']>>,
queryOptions: ApiQueryOptions<Client['getCustomerProductListItem']> = {}
): UseQueryResult<DataType<Client['getCustomerProductListItem']>> => {
): UseQueryResult<DataType<Client['getCustomerProductListItem']>, Error> => {
type Options = Argument<Client['getCustomerProductListItem']>
type Data = DataType<Client['getCustomerProductListItem']>
const {shopperCustomers: client} = useCommerceApi()
Expand All @@ -405,6 +413,7 @@ export const useCustomerProductListItem = (

// For some reason, if we don't explicitly set these generic parameters, the inferred type for
// `Data` sometimes, but not always, includes `Response`, which is incorrect. I don't know why.
// @ts-ignore TODO: Fix react query result error generics
return useQuery<Client, Options, Data>({...netOptions, parameters}, queryOptions, {
method,
queryKey,
Expand All @@ -425,7 +434,7 @@ export const useCustomerProductListItem = (
export const usePublicProductListsBySearchTerm = (
apiOptions: NullableParameters<Argument<Client['getPublicProductListsBySearchTerm']>>,
queryOptions: ApiQueryOptions<Client['getPublicProductListsBySearchTerm']> = {}
): UseQueryResult<DataType<Client['getPublicProductListsBySearchTerm']>> => {
): UseQueryResult<DataType<Client['getPublicProductListsBySearchTerm']>, Error> => {
type Options = Argument<Client['getPublicProductListsBySearchTerm']>
type Data = DataType<Client['getPublicProductListsBySearchTerm']>
const {shopperCustomers: client} = useCommerceApi()
Expand All @@ -450,6 +459,7 @@ export const usePublicProductListsBySearchTerm = (

// For some reason, if we don't explicitly set these generic parameters, the inferred type for
// `Data` sometimes, but not always, includes `Response`, which is incorrect. I don't know why.
// @ts-ignore TODO: Fix react query result error generics
return useQuery<Client, Options, Data>({...netOptions, parameters}, queryOptions, {
method,
queryKey,
Expand All @@ -470,7 +480,7 @@ export const usePublicProductListsBySearchTerm = (
export const usePublicProductList = (
apiOptions: NullableParameters<Argument<Client['getPublicProductList']>>,
queryOptions: ApiQueryOptions<Client['getPublicProductList']> = {}
): UseQueryResult<DataType<Client['getPublicProductList']>> => {
): UseQueryResult<DataType<Client['getPublicProductList']>, Error> => {
type Options = Argument<Client['getPublicProductList']>
type Data = DataType<Client['getPublicProductList']>
const {shopperCustomers: client} = useCommerceApi()
Expand All @@ -495,6 +505,7 @@ export const usePublicProductList = (

// For some reason, if we don't explicitly set these generic parameters, the inferred type for
// `Data` sometimes, but not always, includes `Response`, which is incorrect. I don't know why.
// @ts-ignore TODO: Fix react query result error generics
return useQuery<Client, Options, Data>({...netOptions, parameters}, queryOptions, {
method,
queryKey,
Expand All @@ -515,7 +526,7 @@ export const usePublicProductList = (
export const useProductListItem = (
apiOptions: NullableParameters<Argument<Client['getProductListItem']>>,
queryOptions: ApiQueryOptions<Client['getProductListItem']> = {}
): UseQueryResult<DataType<Client['getProductListItem']>> => {
): UseQueryResult<DataType<Client['getProductListItem']>, Error> => {
type Options = Argument<Client['getProductListItem']>
type Data = DataType<Client['getProductListItem']>
const {shopperCustomers: client} = useCommerceApi()
Expand All @@ -540,6 +551,7 @@ export const useProductListItem = (

// For some reason, if we don't explicitly set these generic parameters, the inferred type for
// `Data` sometimes, but not always, includes `Response`, which is incorrect. I don't know why.
// @ts-ignore TODO: Fix react query result error generics
return useQuery<Client, Options, Data>({...netOptions, parameters}, queryOptions, {
method,
queryKey,
Expand Down
Loading
Loading