Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Enabled use of client pagination in FeathersHook useFind #9128

Merged
merged 1 commit into from
Oct 24, 2023
Merged
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
24 changes: 18 additions & 6 deletions packages/engine/src/common/functions/FeathersHooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,25 @@ export type PaginationQuery = Partial<PaginationProps> & Query
export const useFind = <S extends keyof ServiceTypes>(serviceName: S, params: Params<PaginationQuery> = {}) => {
const paginate = usePaginate(params.query)

const response = useService(serviceName, 'find', {
...params,
query: {
...params.query,
...paginate.query
let requestParams
if (params.query?.paginate === false || params.query?.$paginate === false) {
requestParams = {
...params,
query: {
...params.query
}
}
})
} else {
requestParams = {
...params,
query: {
...params.query,
...paginate.query
}
}
}

const response = useService(serviceName, 'find', requestParams)

const data = response?.data
? Array.isArray(response.data)
Expand Down
Loading