Skip to content

fix(web): cap thumbnail and analytics batches at the 50 id RPC limit - #3528

Merged
richiemcilroy merged 1 commit into
mainfrom
fix/folder-thumbnail-batches
Oct 29, 2026
Merged

richiemcilroy merged 1 commit into
mainfrom
fix/folder-thumbnail-batches

Conversation

@richiemcilroy

@richiemcilroy richiemcilroy commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Folders with more than 50 caps render no thumbnails, and their view counts read 0.

  • Every VideoThumbnail and useVideosAnalyticsQuery request goes through a dataloader that collects everything issued in a 10 ms window into one RPC.
  • VideosGetThumbnails and VideosGetAnalytics both reject payloads over 50 ids (packages/web-domain/src/Video.ts:381). Folder pages are not paginated, so a 51-cap folder sends a 51-id batch, the client-side payload schema fails, and every request in the batch fails.
  • Thumbnails fall back to the gray error gradient. Analytics failures are caught per video and become { count: 0 }.
  • With 51 to roughly 100 caps, thumbnails can show up after react-query's retries, because retries sometimes land in smaller batches. Larger folders never recover.

The fix sets maxBatchSize: 50 on both dataloaders (apps/web/lib/Requests/ThumbnailRequest.ts:47, apps/web/lib/Requests/AnalyticsRequest.ts:45), so a full batch flushes immediately and the next request opens a new one.

flowchart LR
  subgraph Before
    A[600 cards mount] --> B[one batch, 600 ids] --> C[payload schema fails] --> D[600 failures]
  end
  subgraph After
    E[600 cards mount] --> F[12 batches of 50] --> G[12 RPCs] --> H[600 results]
  end
Loading

Pages with 50 or fewer cards, such as /dashboard/caps (15 per page) and paginated space pages, still send a single batch. Their behaviour is unchanged.

Before / after

51-cap folder, 3 s after load:

Before After
before after

Numbers

Production builds of main and this branch on a Mac mini. Both run against the same seeded MySQL and MinIO, with injected round-trip latency (4 ms to the database, 20 ms to S3). Headless Chromium, cold load, median of 5 runs, base and head alternating.

Page Metric main this PR
Folder, 51 caps first thumbnail 7,692 ms 705 ms
Folder, 51 caps visible thumbnails settled 7,938 ms 888 ms
Folder, 600 caps first thumbnail never 1,496 ms
/dashboard/caps, 15 cards first thumbnail 522 ms 533 ms (noise)

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; no blocking issues were found.

Summary

Caps thumbnail and analytics batches at 50 video IDs to match both RPC limits.

  • Large video lists fetch thumbnails and counts in batches of 50.

Reviews (2) · Last reviewed commit: "fix(web): cap thumbnail and analytics ba..." · Reviewed by Greptile

@vercel

vercel Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
cap-status Skipped Skipped Oct 28, 2026 11:49pm UTC

@vercel
vercel Bot temporarily deployed to Preview – cap-status October 28, 2026 23:49 Inactive
@richiemcilroy

Copy link
Copy Markdown
Member Author

hey @greptileai, please re-review the PR

@capy-ai capy-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Capy found no issues.

Open in Capy

@richiemcilroy
richiemcilroy merged commit 50af7e0 into main Oct 29, 2026
50 checks passed

This branch was successfully deployed

1 active and 1 inactive deployments
Preview – cap-web — 89663f7b Deployed Oct 28, 2026 by vercel[bot]
Preview – cap-status — 89663f7b Deployed Oct 28, 2026 by vercel[bot]
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.

1 participant