diff --git a/packages/live-preview/src/mergeData.ts b/packages/live-preview/src/mergeData.ts index 60f497fb209..6bf15503fb2 100644 --- a/packages/live-preview/src/mergeData.ts +++ b/packages/live-preview/src/mergeData.ts @@ -84,7 +84,7 @@ export const mergeData = async >(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()) diff --git a/test/live-preview/int.spec.ts b/test/live-preview/int.spec.ts index 3fa1d915459..2687b8c7348 100644 --- a/test/live-preview/int.spec.ts +++ b/test/live-preview/int.spec.ts @@ -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}`), ) }) })