Skip to content

Commit

Permalink
fix: add missing limit param on useConcept fetch url
Browse files Browse the repository at this point in the history
  • Loading branch information
usamaidrsk committed Jan 17, 2025
1 parent ee44873 commit 1b14984
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/hooks/useConcepts.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useMemo } from 'react';
import useSWRInfinite from 'swr/infinite';
import { type FetchResponse, type OpenmrsResource, openmrsFetch, restBaseUrl } from '@openmrs/esm-framework';
import { type FetchResponse, openmrsFetch, type OpenmrsResource, restBaseUrl } from '@openmrs/esm-framework';

type ConceptFetchResponse = FetchResponse<{ results: Array<OpenmrsResource> }>;

Expand Down Expand Up @@ -28,7 +28,9 @@ export function useConcepts(references: Set<string>): {
const start = index * chunkSize;
const end = start + chunkSize;
const referenceChunk = Array.from(references).slice(start, end);
return `${restBaseUrl}/concept?references=${referenceChunk.join(',')}&v=${conceptRepresentation}`;
return `${restBaseUrl}/concept?references=${referenceChunk.join(
',',
)}&v=${conceptRepresentation}&limit=${chunkSize}`;
};

const { data, error, isLoading } = useSWRInfinite<ConceptFetchResponse, Error>(getUrl, openmrsFetch, {
Expand Down

0 comments on commit 1b14984

Please sign in to comment.