fix(dashboard): Prevent overfetching data (#11532)

**What**
Currently, the dashboard is fetching way more data than needed to display the products. This can lead to issues for complex catalog. this pr aim to reduce the data to be fetched to exactly what is needed.
<img width="2553" alt="Screenshot 2025-02-19 at 15 08 16" src="https://github.com/user-attachments/assets/b00e856c-e040-4f05-9f15-41fb8d299387" />
This commit is contained in:
Adrien de Peretti
2025-02-19 15:26:22 +01:00
committed by GitHub
parent 508b948b9d
commit 0307304dc6
4 changed files with 12 additions and 4 deletions
@@ -6,6 +6,9 @@ type UseProductTableQueryProps = {
pageSize?: number
}
const DEFAULT_FIELDS =
"id,title,handle,status,*collection,*sales_channels,variants.id"
export const useProductTableQuery = ({
prefix,
pageSize = 20,
@@ -58,6 +61,7 @@ export const useProductTableQuery = ({
type_id: type_id?.split(","),
status: status?.split(",") as HttpTypes.AdminProductStatus[],
q,
fields: DEFAULT_FIELDS,
}
return {