feat: add feedback configuration API and integrate feedback feature in sidebar#30
feat: add feedback configuration API and integrate feedback feature in sidebar#30
Conversation
|
🚅 Deployed to the applirank-pr-30 environment in applirank
|
📝 WalkthroughWalkthroughThis PR adds conditional feedback functionality by introducing a new server API endpoint that checks environment configuration and a client component that fetches and respects this setting to control visibility of the GitHub feedback button. Changes
Sequence DiagramsequenceDiagram
participant Client as AppSidebar Component
participant Server as /api/feedback/config
participant Env as Environment
Client->>Server: GET /api/feedback/config
Server->>Env: Check GITHUB_FEEDBACK_TOKEN<br/>and GITHUB_FEEDBACK_REPO
Env-->>Server: Environment variables
Server-->>Client: { enabled: boolean }
Client->>Client: Store as feedbackConfig
alt Feedback Enabled
Client->>Client: Render GitHub feedback button
else Feedback Disabled
Client->>Client: Hide feedback button
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 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.
🧹 Nitpick comments (1)
app/components/AppSidebar.vue (1)
56-61: LGTM — considerlazy: trueto unblock SSR.The
useFetchis correctly keyed, forwards cookies, andisFeedbackEnabledsafely defaults tofalseon error or null data. One optional micro-optimisation: since this config is static between deployments and the button visibility is non-critical, addinglazy: truewould prevent the fetch from blocking the server-side render on every page.💡 Optional: add
lazy: trueconst { data: feedbackConfig } = useFetch('/api/feedback/config', { key: 'feedback-config', headers: useRequestHeaders(['cookie']), + lazy: true, })🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@app/components/AppSidebar.vue` around lines 56 - 61, Add lazy loading to the feedback config fetch so SSR isn't blocked: update the useFetch call that assigns feedbackConfig (const { data: feedbackConfig } = useFetch(...)) to include lazy: true in its options object (alongside key and headers) so the computed isFeedbackEnabled still works but the request is deferred from server-side rendering.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@app/components/AppSidebar.vue`:
- Around line 56-61: Add lazy loading to the feedback config fetch so SSR isn't
blocked: update the useFetch call that assigns feedbackConfig (const { data:
feedbackConfig } = useFetch(...)) to include lazy: true in its options object
(alongside key and headers) so the computed isFeedbackEnabled still works but
the request is deferred from server-side rendering.
Summary
Type of change
Validation
DCO
Signed-off-by) viagit commit -sSummary by CodeRabbit