Skip to content

fix(frontend/copilot): hide New Chat button on Autopilot homepage#12321

Merged
0ubbe merged 2 commits intodevfrom
otto/hide-new-chat-homepage
Mar 9, 2026
Merged

fix(frontend/copilot): hide New Chat button on Autopilot homepage#12321
0ubbe merged 2 commits intodevfrom
otto/hide-new-chat-homepage

Conversation

@Otto-AGPT
Copy link
Contributor

Requested by @0ubbe

The New Chat button was visible on the Autopilot homepage where clicking it has no effect (since sessionId is already null). 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 when sessionId is null
  • MobileDrawer.tsx β€” same fix for mobile drawer

Co-authored-by: Ubbe ubbe@users.noreply.github.com

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.
@Otto-AGPT Otto-AGPT requested a review from a team as a code owner March 6, 2026 15:34
@Otto-AGPT Otto-AGPT requested review from 0ubbe, Bentlybro and kcze and removed request for a team March 6, 2026 15:34
@github-project-automation github-project-automation bot moved this to πŸ†• Needs initial review in AutoGPT development kanban Mar 6, 2026
@github-actions github-actions bot added platform/frontend AutoGPT Platform - Front end size/m labels Mar 6, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 6, 2026

πŸ” PR Overlap Detection

This check compares your PR against all other open PRs targeting the same branch to detect potential merge conflicts early.

🟒 Low Risk β€” File Overlap Only

These 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: openapi.json, lock files.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 6, 2026

No actionable comments were generated in the recent review. πŸŽ‰

ℹ️ Recent review info
βš™οΈ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f632c61a-573c-4ad2-afbf-68df98d2d58f

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 6fcba1e and 8f402ee.

πŸ“’ Files selected for processing (2)
  • autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/ChatSidebar.tsx
  • autogpt_platform/frontend/src/app/(platform)/copilot/components/MobileDrawer/MobileDrawer.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
  • autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/ChatSidebar.tsx
  • autogpt_platform/frontend/src/app/(platform)/copilot/components/MobileDrawer/MobileDrawer.tsx
πŸ“œ 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)
  • GitHub Check: types
  • GitHub Check: end-to-end tests
  • GitHub Check: Check PR Status
  • GitHub Check: Analyze (typescript)
  • GitHub Check: Analyze (python)

Walkthrough

"New Chat" buttons in ChatSidebar and MobileDrawer are now rendered only when a session ID is present; previously they were always rendered.

Changes

Cohort / File(s) Summary
Conditional New Chat Button Rendering
autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatSidebar/ChatSidebar.tsx, autogpt_platform/frontend/src/app/(platform)/copilot/components/MobileDrawer/MobileDrawer.tsx
Replaced unconditional "New Chat" button renders with guarded conditional rendering that shows the button only when a session ID (sessionId or currentSessionId) is truthy.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Suggested labels

size/s

Suggested reviewers

  • Bentlybro
  • kcze

Poem

πŸ‡ I peek and press when sessions glow,
But hide my paw when none will show.
A silent tap, a cautious cheerβ€”
New chats begin when context's near. ✨

πŸš₯ Pre-merge checks | βœ… 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
βœ… Passed checks (2 passed)
Check name Status Explanation
Title check βœ… Passed The title 'fix(frontend/copilot): hide New Chat button on Autopilot homepage' directly and clearly summarizes the main change: hiding the New Chat button on the Autopilot homepage.
Description check βœ… Passed The description is directly related to the changeset, explaining why the New Chat button should be hidden (no effect when sessionId is null) and detailing the files modified and the conditional rendering fix applied.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • πŸ“ Generate docstrings (stacked PR)
  • πŸ“ Generate docstrings (commit on current branch)
πŸ§ͺ Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch otto/hide-new-chat-homepage

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.

❀️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@autogpt-reviewer autogpt-reviewer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ⚠️ β€” Static review only (live environment unavailable due to Docker Hub rate limits). All three button instances verified correct: collapsed sidebar, expanded sidebar, mobile drawer. No layout shift risks β€” flexbox gap collapses naturally, 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)

  1. MobileDrawer.tsx β€” Add basic render test covering currentSessionId null/non-null states (easy win, ~15 lines)
  2. 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.

kcze
kcze approved these changes Mar 7, 2026
@github-project-automation github-project-automation bot moved this from πŸ†• Needs initial review to πŸ‘πŸΌ Mergeable in AutoGPT development kanban Mar 7, 2026
@0ubbe 0ubbe merged commit 0bbb12d into dev Mar 9, 2026
23 checks passed
@0ubbe 0ubbe deleted the otto/hide-new-chat-homepage branch March 9, 2026 14:41
@github-project-automation github-project-automation bot moved this from πŸ‘πŸΌ Mergeable to βœ… Done in AutoGPT development kanban Mar 9, 2026
@github-project-automation github-project-automation bot moved this to Done in Frontend Mar 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

platform/frontend AutoGPT Platform - Front end size/m

Projects

Status: βœ… Done
Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants