fix(frontend/copilot): hide New Chat button on Autopilot homepage#12321
fix(frontend/copilot): hide New Chat button on Autopilot homepage#12321
Conversation
The button has no effect when already on the homepage (sessionId is null). Hide it in both desktop sidebar (collapsed + expanded) and mobile drawer, so it only appears when viewing a chat session.
π PR Overlap DetectionThis check compares your PR against all other open PRs targeting the same branch to detect potential merge conflicts early. π’ Low Risk β File Overlap OnlyThese PRs touch the same files but different sections (click to expand)
Summary: 0 conflict(s), 0 medium risk, 1 low risk (out of 1 PRs with file overlap) Auto-generated on push. Ignores: |
|
No actionable comments were generated in the recent review. π βΉοΈ Recent review infoβοΈ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: π Files selected for processing (2)
π§ Files skipped from review as they are similar to previous changes (2)
π Recent review detailsβ° Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
Walkthrough"New Chat" buttons in ChatSidebar and MobileDrawer are now rendered only when a session ID is present; previously they were always rendered. Changes
Estimated code review effortπ― 2 (Simple) | β±οΈ ~8 minutes Possibly related PRs
Suggested labels
Suggested reviewers
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 |
autogpt-reviewer
left a comment
There was a problem hiding this comment.
PR #12321 β fix(frontend/copilot): hide New Chat button on Autopilot homepage
Author: Otto-AGPT (requested by @0ubbe) | Files: ChatSidebar.tsx (+21/-17), MobileDrawer.tsx (+13/-11)
π― Verdict: APPROVE
What This PR Does
Hides the "New Chat" button in the copilot sidebar (both collapsed and expanded states) and mobile drawer when no chat session is active (sessionId is null). Previously, the button was always visible but clicking it on the homepage was a no-op since handleNewChat calls setSessionId(null), which is already the homepage state.
Specialist Findings
π‘οΈ Security β β No security concerns. Pure UI visibility toggle, no auth/authz changes, no user input rendered, no new data flows.
ποΈ Architecture β
β Clean state coupling. ChatSidebar reads from useQueryState, MobileDrawer receives via prop. Idiomatic {sessionId && (...)} pattern placed at the correct level. No new coupling or tech debt.
β‘ Performance β β Net-positive micro-optimization. Fewer DOM nodes on homepage. No new state, effects, or subscriptions introduced.
π§ͺ Testing β
β No blockers. Zero test baseline for both components is pre-existing debt, not introduced here. All CI checks pass (lint, types, e2e, integration). Suggest adding a basic render test for MobileDrawer in a follow-up.
π Quality β
β Clean, idiomatic React. Consistent naming (sessionId vs currentSessionId appropriate for their contexts). Good detail: MobileDrawer wraps the mt-2 div inside the conditional to avoid empty margin.
π¦ Product β
β Correctly removes a dead button. One UX suggestion: consider disabled state with tooltip ("Start a conversation first") instead of hiding, especially for the expanded desktop sidebar, to preserve discoverability for new users. Not blocking.
π¬ Discussion β
β No unresolved comments. CodeRabbit approved with no actionable items. Low-risk file overlap with PR #12163 (different sections). No human reviews yet β REVIEW_REQUIRED status is process, not a code concern.
π QA mt-2 wrapper also hidden. Conditional variables are correct types (string | null, no empty-string edge case). Recommend manual verification on a running instance.
Blockers
None.
Should Fix (Follow-up OK)
MobileDrawer.tsxβ Add basic render test coveringcurrentSessionIdnull/non-null states (easy win, ~15 lines)ChatSidebar.tsxβ Consider disabled+tooltip instead of hidden for the expanded sidebar "New Chat" button to preserve discoverability
Risk Assessment
Merge risk: LOW | Rollback: EASY
The change is 2 conditional wraps on existing UI elements with no logic changes, no API changes, and no new dependencies. All CI green.
@ntindle Clean, minimal fix that removes a no-op button from the copilot homepage. All 8 specialists approve with zero blockers β safe to merge.
Requested by @0ubbe
The New Chat button was visible on the Autopilot homepage where clicking it has no effect (since
sessionIdis alreadynull). This hides the button when no chat session is active, so it only appears when the user is viewing a conversation and wants to start a new one.Changes:
ChatSidebar.tsxβ hide button in both collapsed and expanded sidebar states whensessionIdis nullMobileDrawer.tsxβ same fix for mobile drawerCo-authored-by: Ubbe ubbe@users.noreply.github.com