Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion packages/live-preview/src/mergeData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export const mergeData = async <T extends Record<string, any>>(args: {
res = await requestHandler({
apiPath: apiRoute || '/api',
endpoint: encodeURI(
`${collection}?depth=${depth}&where[id][in]=${Array.from(ids).join(',')}${locale ? `&locale=${locale}` : ''}`,
`${collection}?depth=${depth}&limit=${ids.size}&where[id][in]=${Array.from(ids).join(',')}${locale ? `&locale=${locale}` : ''}`,
),
serverURL,
}).then((res) => res.json())
Expand Down
2 changes: 1 addition & 1 deletion test/live-preview/int.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1463,7 +1463,7 @@ describe('Collections - Live Preview', () => {
// Verify that the request was made to the properly encoded URL
// Without encodeURI wrapper the request URL - would receive string: "undefined/api/posts?depth=1&where[id][in]=66ba7ab6a60a945d10c8b976,66ba7ab6a60a945d10c8b979
expect(capturedEndpoint).toContain(
encodeURI(`posts?depth=1&where[id][in]=${testPost.id},${testPostTwo.id}`),
encodeURI(`posts?depth=1&limit=2&where[id][in]=${testPost.id},${testPostTwo.id}`),
)
})
})