fix: load dashboard playbooks by exact ID - #143
Conversation
📝 WalkthroughWalkthroughThe project skill page now validates route IDs and requests a matching playbook directly. The Reflexio client supports passing ChangesProject skill lookup
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant ProjectSkillPage
participant ReflexioClient
participant GetUserPlaybooksEndpoint
participant ProjectSkillUI
ProjectSkillPage->>ProjectSkillPage: Parse and validate params.id
ProjectSkillPage->>ReflexioClient: getUserPlaybooks({ userPlaybookId, limit: 1 })
ReflexioClient->>GetUserPlaybooksEndpoint: POST user_playbook_id
GetUserPlaybooksEndpoint-->>ReflexioClient: Return matching playbook
ReflexioClient-->>ProjectSkillPage: Return first playbook
ProjectSkillPage->>ProjectSkillUI: Render playbook or not-found view
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
plugin/dashboard/app/skills/project/[id]/page.tsx (1)
76-95: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winReset route-scoped state before the next lookup.
The effect reruns for a new
userPlaybookId, butnotFound,playbook, anderrorcan remain from the previous route. After navigating from a missing ID to a valid/skills/project/87, a successful response can setplaybookwhile the not-found guard renders first; invalid-to-valid navigation can also show stale errors/form and valid-to-valid navigation can show stale content/errors while fetching.Suggested fix
useEffect(() => { let cancelled = false; + setNotFound(false); + setPlaybook(null); + setError(null); + setEditing(false); if (invalidId) return;Also add a missing-to-valid navigation regression test.
🤖 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 `@plugin/dashboard/app/skills/project/`[id]/page.tsx around lines 76 - 95, Reset route-scoped state at the start of the effect that loads the playbook for each new userPlaybookId: clear notFound, error, playbook, and the form state before validating or fetching. Preserve the existing cancellation and response handling, and add a regression test covering navigation from a missing ID to a valid ID to ensure stale not-found state does not block the loaded playbook.Sources: Coding guidelines, MCP tools
🤖 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.
Outside diff comments:
In `@plugin/dashboard/app/skills/project/`[id]/page.tsx:
- Around line 76-95: Reset route-scoped state at the start of the effect that
loads the playbook for each new userPlaybookId: clear notFound, error, playbook,
and the form state before validating or fetching. Preserve the existing
cancellation and response handling, and add a regression test covering
navigation from a missing ID to a valid ID to ensure stale not-found state does
not block the loaded playbook.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 473f7988-181d-401d-a978-cb27c32aa401
📒 Files selected for processing (2)
plugin/dashboard/app/skills/project/[id]/page.tsxplugin/dashboard/lib/reflexio-client.ts
Summary
user_playbook_idwith a one-record limit.Changes
/skills/project/[id]to request and render the exact API result.Test Plan
npx biome check 'app/skills/project/[id]/page.tsx' lib/reflexio-client.tsnpx tsc --noEmitnpm run builduv run --project plugin pytest --rootdir . -o addopts= tests/test_dashboard_install.py tests/test_dashboard_managed_reflexio.py -qhttp://localhost:3001/skills/project/87renders playbook 87 through the dashboard API proxy.Follow-ups
maincommit before merging the enterprise PR.