Move project tab refreshes into resource actions - #339
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 21 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?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 reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. 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, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughAdds a new ChangesRefresh resource atoms migration
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant ProjectScreen
participant refreshProjectObservabilityResourceAtom
participant refreshProjectTasksResourceAtom
participant API
ProjectScreen->>refreshProjectObservabilityResourceAtom: set({projectPath, endpoint, getToken})
ProjectScreen->>refreshProjectTasksResourceAtom: set({projectPath, endpoint, getToken})
refreshProjectObservabilityResourceAtom->>API: getProjectObservability(endpoint, token)
refreshProjectTasksResourceAtom->>API: listTasks(endpoint, token)
API-->>refreshProjectObservabilityResourceAtom: observability data
API-->>refreshProjectTasksResourceAtom: tasks data
refreshProjectObservabilityResourceAtom-->>ProjectScreen: apply success/failure
refreshProjectTasksResourceAtom-->>ProjectScreen: apply success/failure
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
app/stores/projectRefresh.ts (1)
30-96: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDuplicate fetch/begin/apply orchestration between the two atoms.
refreshProjectObservabilityResourceAtomandrefreshProjectTasksResourceAtomare structurally identical (requestKey build → begin → try/fetch/success → catch/failure). Consider extracting a shared helper parameterized by the begin/success/failure atoms and the fetch call, to avoid drift as more resources are added.♻️ Possible consolidation
+async function runResourceRefresh<TSuccessPayload>( + set: <A extends unknown[], R>(atom: WritableAtom<unknown, A, R>, ...args: A) => R, + { projectPath, endpoint, getToken }: RefreshProjectApiResourceInput, + clearAtom: WritableAtom<unknown, [string], void>, + beginAtom: WritableAtom<unknown, [{ projectPath: string; requestKey: string }], void>, + fetchFn: (endpoint: ServiceEndpoint, token: string | null) => Promise<TSuccessPayload>, + successAtom: WritableAtom<unknown, [{ projectPath: string; requestKey: string; payload: TSuccessPayload }], void>, + failureAtom: WritableAtom<unknown, [{ projectPath: string; requestKey: string; error: string }], void>, +) { + if (!endpoint) { + set(clearAtom, projectPath); + return; + } + const requestKey = projectResourceRequestKey({ projectPath, endpointKey: endpointKey(endpoint), generation: 0 }); + set(beginAtom, { projectPath, requestKey }); + try { + const token = await getToken(); + const payload = await fetchFn(endpoint, token); + set(successAtom, { projectPath, requestKey, payload }); + } catch (err) { + set(failureAtom, { projectPath, requestKey, error: errorMessage(err) }); + } +}🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@app/stores/projectRefresh.ts` around lines 30 - 96, The two refresh atoms duplicate the same requestKey/begin/try-fetch/success/catch-failure flow, so extract the shared orchestration into a helper that takes the begin/success/failure atoms plus the fetch function. Use the existing refreshProjectObservabilityResourceAtom and refreshProjectTasksResourceAtom as callers, and keep their resource-specific response mapping inside the helper parameters to prevent future drift when adding more project resources.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@app/stores/projectRefresh.ts`:
- Around line 30-96: The two refresh atoms duplicate the same
requestKey/begin/try-fetch/success/catch-failure flow, so extract the shared
orchestration into a helper that takes the begin/success/failure atoms plus the
fetch function. Use the existing refreshProjectObservabilityResourceAtom and
refreshProjectTasksResourceAtom as callers, and keep their resource-specific
response mapping inside the helper parameters to prevent future drift when
adding more project resources.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 1be371e6-45de-4860-9f40-b6e5a3039824
📒 Files selected for processing (4)
app/app/(main)/(tabs)/project/index.tsxapp/stores/project.test.tsapp/stores/projectRefresh.tsdocs/core-sidecar-north-star.md
Summary
Verification
Summary by CodeRabbit