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

✨ Recursively load queue pages if current page is empty #185

Merged
merged 3 commits into from
Sep 11, 2024

Conversation

foysalit
Copy link
Contributor

This avoids showing empty queue or hitting Load More and not getting new items when multiple queues are active.

@arcalinea arcalinea temporarily deployed to avoid-empty-queue-page - ozone-staging PR #185 September 11, 2024 15:18 — with Render Destroyed
Comment on lines 392 to 395
// This is a recursive call to get items in queue if the current page
// gives us less than full page size and there are more items to fetch
if (statusesInQueue.length === 0 && data.cursor) {
return getQueueItems(
Copy link
Collaborator

@devinivy devinivy Sep 11, 2024

Choose a reason for hiding this comment

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

Only think I am a little unsure about here is that it would be easy to create a bug on the server side that causes this to spin and cause tons of requests. The fix, I think, would be to pass a counter as a last arg to getQueueItems() that ensures we don't fetch more than maybe 10-15 pages this way.

@arcalinea arcalinea temporarily deployed to avoid-empty-queue-page - ozone-staging PR #185 September 11, 2024 15:30 — with Render Destroyed
@foysalit foysalit merged commit 03dbb07 into main Sep 11, 2024
3 checks passed
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.

3 participants