#useQueries response returning the same for both queries
4 messages · Page 1 of 1 (latest)
all values used in the queryfn must be part of the queryKey
@urban kernel exact same thing when I do that:
` const featureProducts = useQueries({
// eslint-disable-next-line no-extra-boolean-cast
queries: !!carouselProducts?.length
? carouselProducts?.map((carousel: IPromoType) => {
return {
key: carousel.label,
enabled: !!carouselProducts.length,
queryKey: [
'products',
carousel.label,
carousel.products,
currentStore?.chain?.name,
currentStore?.master_id,
'gtin',
],
queryFn: async () => {
const productList: Product = await getProducts({
tree: currentStore?.chain?.name || '',
storeId: currentStore?.master_id || '',
type: 'gtin',
query: carousel.products.gtin,
pageSize: 11,
page: 2,
});
return {
product: productList?.products,
label: carousel?.label,
// gtin: [...carouselProducts.products],
};
},
};
})
: [],
});`
when I map over the response, the content is exactly the same
however the labels do come out differently cos they're from the first query being depended on