Skip to content

🎚️ refactor: Move Pane Preset and Option Settings to Jotai in the Chat Package - #17179

Merged
berry-13 merged 1 commit into
devfrom
refactor/chat-pane-atoms
Oct 16, 2026
Merged

berry-13 merged 1 commit into
devfrom
refactor/chat-pane-atoms

Conversation

@berry-13

Copy link
Copy Markdown
Collaborator

Pull Request

Summary

Each chat pane's applied preset and its option toggles (show examples, code chat) were Recoil atom families in client/src/store/families.ts, so useChatHelpers still had to reach into ~/store for state only the chat pane owns. A third family, showPopoverFamily, was written into the chat contract but never read by any component.

This moves presetByIndex and optionSettingsFamily to Jotai families under packages/chat/src/react/pane/ (presetFamily, optionSettingsFamily, exported from @librechat/chat/react) together with every consumer: useChatHelpers, usePresets, PresetsMenu and the sign-out reset in useClearStates. showPopoverFamily is removed along with the showPopover/setShowPopover fields of the chat contract. TOptionSettings now aliases the package's PaneOptionSettings. Behavior is unchanged: both families keep their defaults (null and {}) per pane index, and sign-out still resets every pane except the kept first one.

This is one step of moving feature-owned chat state onto Jotai inside the chat package and cutting the chat hooks' reads of ~/store.

Type of change

  • Refactor

Testing

Tested environments/configuration:

  • No runtime configuration involved; the change is a state-library swap with identical defaults and the same consumers.

Automated tests:

  • Added packages/chat/src/react/pane/__tests__/pane.spec.ts (defaults and per-pane isolation).
  • Added a useClearStates case asserting that sign-out resets the preset and option settings of every pane, and keeps pane 0 when skipFirst is set.
  • submitting.spec.tsx used presetByIndex as its stand-in Recoil atom; it now uses activePromptByIndex, which stays on Recoil.
  • npx jest over ChatForm, hooks/Chat/__tests__, useClearStates, Chat/Menus and hooks/Conversations: 51 suites, 916 tests passed.
  • npm run typecheck in client and packages/chat: no errors. ESLint, Prettier and import sorting clean on the changed files.

Screenshots / recordings

No user-facing change.

Copilot AI balanced review requested due to automatic review settings October 16, 2026 08:28

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 was unable to review this pull request because the user who requested the review has reached their quota limit.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 16, 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-16T19:44:22.823660Z f433e34 New commits
🔒 Security Review ✅ Completed 2026-10-16T08:32:03.069833Z d3c34bc PR opened
ℹ️ 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.

@berry-13
berry-13 force-pushed the refactor/chat-pane-atoms branch from d3c34bc to f433e34 Compare October 16, 2026 19:42
@berry-13
berry-13 added this pull request to stack #17195 October 16, 2026 21:03
@berry-13
berry-13 merged commit 63983c9 into dev Oct 16, 2026
43 checks passed
@berry-13
berry-13 deleted the refactor/chat-pane-atoms branch October 16, 2026 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants