Harden plan editor resource lifecycle - #337
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: 40 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 (3)
📝 WalkthroughWalkthroughAdds a project plan resource lifecycle to the Jotai project store (types, atoms for begin/apply success/failure/edit/save/clear/settle), migrates the plan editor screen from local React state to these atoms with a request tracker, adds corresponding test coverage, and updates documentation/guidelines to reflect the shared resource pattern. ChangesProject plan resource migration
Estimated code review effort: 3 (Moderate) | ~30 minutes Sequence Diagram(s)sequenceDiagram
participant PlanEditorScreen
participant ProjectStoreAtoms
participant PlanAPI
PlanEditorScreen->>ProjectStoreAtoms: beginProjectPlanRefreshAtom(planKey)
PlanEditorScreen->>PlanAPI: getPlan(planKey)
PlanAPI-->>PlanEditorScreen: plan data or 404
PlanEditorScreen->>ProjectStoreAtoms: applyProjectPlanSuccessAtom / applyProjectPlanFailureAtom
PlanEditorScreen->>ProjectStoreAtoms: editProjectPlanDraftAtom(content)
PlanEditorScreen->>PlanAPI: putPlan(content)
PlanAPI-->>PlanEditorScreen: save result
PlanEditorScreen->>ProjectStoreAtoms: applyProjectPlanSaveSuccessAtom / applyProjectPlanActionFailureAtom
PlanEditorScreen->>ProjectStoreAtoms: refreshPlan()
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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.
Inline comments:
In `@app/app/`(main)/(tabs)/(dashboard)/plans/[sessionId].tsx:
- Around line 72-75: The refreshPlan logic in the useCallback should not clear
draft data just because serviceEndpoint is temporarily missing. Update the guard
in refreshPlan so clearPlanResource(planKey) only runs when there is no valid
session or the plan is the NO_PROJECT_PLAN_KEY case; if projectPath/sessionId
still identify a real plan, keep the existing resource and simply skip the fetch
until the endpoint returns.
In `@app/stores/project.ts`:
- Around line 505-531: applyProjectPlanSaveSuccessAtom is overwriting the live
draft in projectPlanResourceFamily when a save resolves, which can clobber user
edits made after clicking save. Update the atom so it preserves the current
draft content from the existing projectPlanResourceFamily state when it has
diverged from the saved payload, and only refresh savedContent, sessionId,
fetchedAt, error, stale, and updatedAt in the success path. Use
applyProjectPlanSaveSuccessAtom and projectPlanResourceFamily to locate the
logic and keep the editor value stable while a putPlan request is in flight.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 792ffde5-e67e-4a07-a4db-6e56db7a2e42
📒 Files selected for processing (5)
AGENTS.mdapp/app/(main)/(tabs)/(dashboard)/plans/[sessionId].tsxapp/stores/project.test.tsapp/stores/project.tsdocs/core-sidecar-north-star.md
Summary
Verification
Summary by CodeRabbit
New Features
Bug Fixes
Documentation