feat: ctx.data.staleWhileRevalidate() — host-owned stale-while-revalidate for extension views#46
Conversation
…validate for extension views Extensions can now show cached items immediately with a subtle loading bar while fresh data loads in the background. - Synchronous API: returns a DataLoaderHandle, matches ctx.data.loader() - Host-owned lifecycle: cache read/write/hydration in the loader registry - Fresh cache (<ttlMs): items render instantly, no loader runs - Stale cache (<staleTtlMs): cached items + loading bar, background refresh - No cache: deferred spinner (same as loader()) - Loader failure + stale cache: graceful fallback to stale items - New .viewLoadingBar: 2px animated gradient when isLoading && hasItems - Hydrate contract: ViewHydratePayload.isLoading widened to boolean - 5 new tests covering handle shape, stale hydrate, fresh skip, fallback
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reached
More reviews will be available in 10 minutes and 32 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (8)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
What
Adds
ctx.data.staleWhileRevalidate()— a synchronous host-owned stale-while-revalidate primitive for extension views. Extensions show cached items immediately with a subtle loading bar while fresh data loads in the background.Before
Extensions had two bad options for data views:
After
Also fixed
The loading indicator was broken when items existed —
isLoadingonly showed a spinner when items were empty. Added a subtle 2px animated gradient bar (.viewLoadingBar) that renders in list/grid views when bothisLoadingand items are present.Changes (8 files, +389/-8)
src/electron/data-loader.ts— extendedDataLoaderHandle, registry spawn() owns full S-W-R lifecyclesrc/electron/main.ts— syncstaleWhileRevalidate()API in extension contextsrc/electron/data-loader.test.ts— 5 new testssrc/resources/nevermind-extension-api.d.ts— API types + TSDocsrc/ui.tsx—viewLoadingBarin ListView/GridViewsrc/styles.css— loading bar animationsrc/App.tsx— hydrate respectspayload.isLoadingsrc/preload-api.ts— widenedViewHydratePayload.isLoadingValidation