Skip to content

Commit

Permalink
fix: use collectionIds instead of collection_ids for fn param
Browse files Browse the repository at this point in the history
  • Loading branch information
jhpedemonte committed Jan 19, 2024
1 parent 7c45530 commit 0cb18df
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ describe('DiscoverySearch', () => {
expect(spy).toHaveBeenCalledWith({
projectId: 'foo',
filter: 'document_id::bar',
collection_ids: ['12345-12345-12345-12345'],
collectionIds: ['12345-12345-12345-12345'],
aggregation: '',
passages: {
enabled: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,7 @@ describe('useFetchDocumentsApi', () => {
fireEvent.click(fetchDocumentsButton, { target: { value: 'filter_string' } });
expect(checkParametersMock).toHaveBeenCalledWith({
projectId: 'foo',
collection_ids: ['12345-12345-12345-12345'],
collectionIds: ['12345-12345-12345-12345'],
_return: [],
aggregation: '',
passages: {},
Expand Down
8 changes: 5 additions & 3 deletions packages/discovery-react-components/src/utils/useDataApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -454,9 +454,11 @@ export const useFetchDocumentsApi = (

const fetchDocuments: FetchDocumentsActions['fetchDocuments'] = useCallback(
(filter, collections, callback) => {
setSearchParameters((currentSearchParameters: DiscoveryV2.QueryParams) => {
return { ...currentSearchParameters, filter, collection_ids: collections };
});
setSearchParameters(
(currentSearchParameters: DiscoveryV2.QueryParams): DiscoveryV2.QueryParams => {
return { ...currentSearchParameters, filter, collectionIds: collections };
}
);
setFetchToken({ trigger: true, callback });
},
[setSearchParameters, setFetchToken]
Expand Down

0 comments on commit 0cb18df

Please sign in to comment.