Fix order of flattenPages func

This commit is contained in:
Justin 2022-09-29 12:04:23 -04:00
parent b0ea57b9b9
commit 9d20d0d032

View file

@ -11,7 +11,7 @@ export interface PaginatedResult<T> {
/** Flatten paginated results into a single array. */
const flattenPages = <T>(queryInfo: UseInfiniteQueryResult<PaginatedResult<T>>) => {
return queryInfo.data?.pages.reduce<T[]>(
(prev: T[], curr) => [...prev, ...curr.result],
(prev: T[], curr) => [...curr.result, ...prev],
[],
);
};