Skip to content

refactor(web): move chat storage keys to constants and clear search scope on thread creation#1033

Merged
brendan-kellam merged 3 commits intomainfrom
bkellam/refactor-chat-storage-constants
Mar 23, 2026
Merged

refactor(web): move chat storage keys to constants and clear search scope on thread creation#1033
brendan-kellam merged 3 commits intomainfrom
bkellam/refactor-chat-storage-constants

Conversation

@brendan-kellam
Copy link
Contributor

@brendan-kellam brendan-kellam commented Mar 23, 2026

Summary

  • Moves SET_CHAT_STATE_SESSION_STORAGE_KEY from chat/types.ts to chat/constants.ts
  • Adds SELECTED_SEARCH_SCOPES_LOCAL_STORAGE_KEY to chat/constants.ts
  • Clears the persisted search scope selection when a chat thread page mounts, so returning to the landing page to start a new thread starts with a clean state

Test plan

  • Select a search scope on the landing page, refresh — selection should persist
  • Submit a question — selection should remain visible during navigation to the thread
  • Navigate back to the landing page — selection should be cleared

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Fixed search scope selection persisting after creating a new thread in the ask UI.

…cope on thread creation

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions

This comment has been minimized.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 23, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8656ca37-254e-4693-b07e-b72eb114d1f6

📥 Commits

Reviewing files that changed from the base of the PR and between 783acaa and b9ecba1.

📒 Files selected for processing (6)
  • CHANGELOG.md
  • packages/web/src/app/[domain]/chat/[id]/components/chatThreadPanel.tsx
  • packages/web/src/app/[domain]/chat/components/landingPageChatBox.tsx
  • packages/web/src/features/chat/constants.ts
  • packages/web/src/features/chat/types.ts
  • packages/web/src/features/chat/useCreateNewChatThread.ts

Walkthrough

Consolidated chat storage keys into a constants module, updated components/hooks to import those keys, switched landing page to use the constant for selected search scopes, and added logic in the chat thread panel to clear the persisted search-scope selection on mount. Changelog updated.

Changes

Cohort / File(s) Summary
Constants Consolidation
packages/web/src/features/chat/constants.ts, packages/web/src/features/chat/types.ts
Added SELECTED_SEARCH_SCOPES_LOCAL_STORAGE_KEY and SET_CHAT_STATE_SESSION_STORAGE_KEY to constants.ts; removed SET_CHAT_STATE_SESSION_STORAGE_KEY export from types.ts.
Storage Key Usage Updates
packages/web/src/app/[domain]/chat/components/landingPageChatBox.tsx, packages/web/src/app/[domain]/chat/[id]/components/chatThreadPanel.tsx, packages/web/src/features/chat/useCreateNewChatThread.ts
Replaced hardcoded/local selectedSearchScopes key usage with the exported constant; updated imports to use constants.ts; added a mount-only effect in chatThreadPanel.tsx to remove the persisted selectedSearchScopes from localStorage.
Changelog
CHANGELOG.md
Added Unreleased → Fixed entry noting that search scope selection no longer persists after creating a new thread.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • msukkari
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bkellam/refactor-chat-storage-constants

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.

@brendan-kellam brendan-kellam merged commit d8acfae into main Mar 23, 2026
6 checks passed
@brendan-kellam brendan-kellam deleted the bkellam/refactor-chat-storage-constants branch March 23, 2026 22:44
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.

1 participant