Skip to content
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

fix: fetch all referenced entities #507

Merged
merged 6 commits into from
Mar 21, 2024

Conversation

ChidinmaOrajiaku
Copy link
Contributor

Purpose

Previously we only fetched 100 referenced entities. So for experiences with more than 100 entities bound, we only render 100 entities.

This PR fetches all bound entities in chunks of 100.

If we encounter a response too big error during fetch, we reduce the limit and try fetching again.

Screen.Recording.2024-03-20.at.15.37.47.mov

Approach

Copy link

vercel bot commented Mar 20, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
experience-builder-test-app ✅ Ready (Inspect) Visit Preview Mar 21, 2024 8:51am

expect(mockClient.withoutLinkResolution.getEntries).toHaveBeenNthCalledWith(11, {
'sys.id[in]': params.ids,
locale: 'en-US',
skip: 90,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is skip expected to be 90 here? It looks from the previous request that the fetch started from skip: 0 and limit: 20.

I thought that after an error the next request should have parameters skip: 0 and limit: 10. Unless I misunderstood something

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, no, sorry, I understand it now.

100 / 10 = 10 per batch. 1 request failed , so 10 + 1 request is the last one to fetch the remaining 10 items. All good :D

Copy link
Collaborator

@Spring3 Spring3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works correctly. Love it! Also big thanks for the tests - really stellar piece of work!

Screen.Recording.2024-03-20.at.17.27.03.mov

@ChidinmaOrajiaku ChidinmaOrajiaku merged commit 099dcd6 into development Mar 21, 2024
9 checks passed
@ChidinmaOrajiaku ChidinmaOrajiaku deleted the fix/fetch-all-references branch March 21, 2024 08:58
dimitrycf added a commit that referenced this pull request Mar 22, 2024
dimitrycf added a commit that referenced this pull request Mar 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants