Skip to content

fix(live-preview): client-side live preview cannot populate more than 10 relationships at once #12929

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 26, 2025
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}`),
)
})
})