Skip to content

🎛️ refactor: Pass the New-Chat Panel Preference Into the Sidebar - #16605

Merged
berry-13 merged 2 commits into
devfrom
berry-13/followup-214-new-chat-switch-to-history
Oct 1, 2026
Merged

berry-13 merged 2 commits into
devfrom
berry-13/followup-214-new-chat-switch-to-history

Conversation

@berry-13

@berry-13 berry-13 commented Oct 1, 2026

Copy link
Copy Markdown
Collaborator

Pull Request

Summary

The sidebar's two new-chat controls, the desktop rail's button and the mobile drawer's, each read the app-global "new chat returns to the chat list" preference (newChatSwitchToHistory) straight from ~/store. The sidebar only consumes that preference, so under the client state ownership rule it should be handed in by the host rather than reached for.

Root now reads the preference and passes it to UnifiedSidebar as switchToHistory, which hands it to the desktop ExpandedPanel and the mobile drawer header. Neither new-chat control imports Recoil or the store any more. Behavior is unchanged: with the preference on, starting a chat from another panel brings the chat list back, and with it off the current panel stays.

Fixes berry-13#214. Stacked on #16248, which adds the mobile drawer's new-chat control this changes.

Type of change

  • Refactor

Testing

Tested environments/configuration:

  • Chromium, desktop 1280x800 and phone 390x844 (loaded at phone width), mock harness

Automated tests:

  • e2e/specs/mock/scenarios/new-chat-panel-preference.spec.ts: on desktop and in the mobile drawer, New chat from another panel returns to the chat list with the preference on and keeps the panel with it off
  • npx jest src/components/UnifiedSidebar (client): 10 suites, 56 tests pass, including the mobile control following the passed-in preference both ways
  • npx tsc --noEmit -p client/tsconfig.json: clean

Screenshots / recordings

No user-facing change.

Risk / compatibility

None. The stored preference, its default and its settings toggle are unchanged; only where the sidebar gets the value from changes.

Checklist

  • I reviewed my own changes
  • Relevant tests have been added or updated
  • Existing relevant tests pass
  • The change does not introduce new warnings or errors

@berry-13
berry-13 marked this pull request as ready for review October 1, 2026 09:54
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-01T16:01:53.805079Z 9edd05f New commits
đź”’ Security Review âś… Completed 2026-10-01T09:58:19.732095Z abcf82e Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@codegraph-librechat codegraph-librechat Bot added the 🗺️ Chat UI Shell codegraph: the taxonomy area this belongs to (classifier, confidence ≥ 0.9) label Oct 1, 2026
Base automatically changed from berry-13/mobile-drawer-controls to canary October 1, 2026 10:28
@berry-13
berry-13 added this pull request to stack #16613 October 1, 2026 10:32
@berry-13
berry-13 force-pushed the berry-13/followup-214-new-chat-switch-to-history branch 2 times, most recently from 130a1d8 to 153e766 Compare October 1, 2026 14:00
@berry-13
berry-13 requested a review from danny-avila as a code owner October 1, 2026 14:00
@berry-13
berry-13 removed this pull request from stack #16613 October 1, 2026 14:02
@berry-13
berry-13 changed the base branch from canary to dev October 1, 2026 14:02
@berry-13
berry-13 added this pull request to stack #16625 October 1, 2026 14:05
@berry-13 berry-13 closed this Oct 1, 2026
@berry-13 berry-13 reopened this Oct 1, 2026
Both new-chat controls, the desktop rail's and the mobile drawer's, read
newChatSwitchToHistory straight from the store. It is an app-global
preference the sidebar only consumes, so the host (Root) reads it and
passes it down, and the sidebar no longer reaches into the store for it.
Copilot AI balanced review requested due to automatic review settings October 1, 2026 15:59
@berry-13
berry-13 force-pushed the berry-13/followup-214-new-chat-switch-to-history branch from 153e766 to 9edd05f Compare October 1, 2026 15:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The refactor satisfies the state-ownership requirement and provides focused coverage without changing observable behavior.

Review effort: Balanced
Findings: None

What changed in this PR

Moves the new-chat panel preference to the sidebar’s host-owned interface, removing direct store access while preserving behavior.

Changes:

  • Passes switchToHistory from Root through desktop and mobile sidebar paths.
  • Removes Recoil preference reads from both new-chat controls.
  • Adds unit and end-to-end coverage for enabled and disabled states.
File Description
e2e/​specs/​mock/​scenarios/​new-chat-panel-preference.spec.ts Tests preference behavior on desktop and mobile.
client/​src/​routes/​Root.tsx Reads and supplies the global preference.
client/​src/​components/​UnifiedSidebar/​UnifiedSidebar.tsx Exposes and routes the preference prop.
client/​src/​components/​UnifiedSidebar/​Sidebar.tsx Forwards the preference to the desktop panel.
client/​src/​components/​UnifiedSidebar/​ExpandedPanel.tsx Uses the supplied preference for desktop new chat.
client/​src/​components/​UnifiedSidebar/​mobile/​Header.tsx Forwards the preference to mobile new chat.
client/​src/​components/​UnifiedSidebar/​mobile/​NewChat.tsx Uses the supplied preference instead of Recoil.
client/​src/​components/​UnifiedSidebar/​__tests__/​ExpandedPanel.spec.tsx Updates desktop preference tests.
client/​src/​components/​UnifiedSidebar/​__tests__/​drawerPaint.spec.tsx Updates sidebar test setup for the required prop.
client/​src/​components/​UnifiedSidebar/​mobile/​__tests__/​Header.spec.tsx Updates mobile header test setup.
client/​src/​components/​UnifiedSidebar/​mobile/​__tests__/​NewChat.spec.tsx Tests both mobile preference states.

đź’ˇ Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@berry-13
berry-13 merged commit 66dd692 into dev Oct 1, 2026
31 checks passed
@berry-13
berry-13 deleted the berry-13/followup-214-new-chat-switch-to-history branch October 1, 2026 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🗺️ Chat UI Shell codegraph: the taxonomy area this belongs to (classifier, confidence ≥ 0.9)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants