import type { InfiniteData } from '@tanstack/react-query'; import type { PaginatedResponse } from 'pl-api'; /** Flatten paginated results into a single array. */ const flattenPages = (queryData: InfiniteData, 'items'>> | undefined) => { return queryData?.pages.reduce( (prev: T[], curr) => [...prev, ...(curr.items)], [], ); }; export { flattenPages };