Skip to content
Open
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import { useProductTableQuery } from "../../../../../hooks/table/query/use-produ
import { useDataTable } from "../../../../../hooks/use-data-table"
import { productsLoader } from "../../loader"

export const PAGE_SIZE = 5
export const PAGE_SIZE = 10

export const ProductListTable = () => {
const { t } = useTranslation()
Expand All @@ -54,25 +54,32 @@ export const ProductListTable = () => {
const { searchParams, raw } = useProductTableQuery({
pageSize: PAGE_SIZE,
})

const query = {
limit: 100,
offset: 0,
Comment on lines +59 to +60
Copy link
Collaborator

Choose a reason for hiding this comment

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

shouldn't we just paginate the BE response?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

it would required from us chagned from backend side

fields: "+thumbnail,*categories,+status",
}

const options = {
initialData,
placeholderData: keepPreviousData,
}

const filter = {
collectionId: searchParams.collection_id,
categoryId: searchParams.category_id,
typeId: searchParams.type_id,
tagId: searchParams.tagId,
status: searchParams.status,
q: searchParams.q,
sort: searchParams.order,
}

const { products, count, isLoading, isError, error } = useProducts(
{
limit: searchParams.limit,
offset: searchParams.offset,
fields: "+thumbnail,*categories,+status",
},
{
initialData,
placeholderData: keepPreviousData,
},
{
collectionId: searchParams.collection_id,
categoryId: searchParams.category_id,
typeId: searchParams.type_id,
tagId: searchParams.tagId,
status: searchParams.status,
q: searchParams.q,
sort: searchParams.order,
}
query,
options,
filter
)

const offset = searchParams.offset || 0
Expand Down