Skip to content

Conversation

@AnthonyRonning
Copy link
Contributor

@AnthonyRonning AnthonyRonning commented Dec 29, 2025

Implements localStorage persistence for the web search toggle following the same pattern as other user preferences (fullscreen mode, selected model).

The web search toggle state is now:

  • Initialized from localStorage on component mount
  • Persisted to localStorage whenever the state changes
  • Uses the key "webSearchEnabled" for storage

This ensures users don't have to re-enable web search every time they start a new chat session.

Fixes #349

Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Web search toggle preference now persists across browser sessions.

✏️ Tip: You can customize this high-level summary in your review settings.

Implements localStorage persistence for the web search toggle following
the same pattern as other user preferences (fullscreen mode, selected model).

The web search toggle state is now:
- Initialized from localStorage on component mount
- Persisted to localStorage whenever the state changes
- Uses the key "webSearchEnabled" for storage

This ensures users don't have to re-enable web search every time they
start a new chat session.

Fixes #349

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: Anthony <AnthonyRonning@users.noreply.github.com>
@coderabbitai
Copy link

coderabbitai bot commented Dec 29, 2025

📝 Walkthrough

Walkthrough

Added localStorage persistence to the web search toggle in UnifiedChat.tsx. The isWebSearchEnabled state now initializes from stored preferences and syncs changes back to localStorage, replacing the previous in-memory-only implementation.

Changes

Cohort / File(s) Summary
Web Search Toggle Persistence
frontend/src/components/UnifiedChat.tsx
Added localStorage initialization for isWebSearchEnabled state and useEffect hook to persist toggle state changes to localStorage ("webSearchEnabled" key).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

A toggle that remembers, forever it stays,
No more forgotten settings in all the ways,
The rabbit hops through localStorage's cache,
Web search preferences now never will crash,
Persistence achieved with a useEffect match! 🐰

Pre-merge checks and finishing touches

❌ 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%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'feat: Remember web search toggle state' accurately and concisely describes the main change: adding persistence for the web search toggle.
Linked Issues check ✅ Passed The code changes implement localStorage persistence for the web search toggle as requested in issue #349, following the same pattern as existing user preferences.
Out of Scope Changes check ✅ Passed All changes are scoped to the web search toggle persistence feature; no unrelated modifications are present in the changeset.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch claude/issue-349-20251229-1640

📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 97e07bb and 11866fe.

📒 Files selected for processing (1)
  • frontend/src/components/UnifiedChat.tsx
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx}: Use path aliases (@/* maps to ./src/*) for imports in TypeScript/React files
Use 2-space indentation, double quotes, and enforce 100-character line limit in TypeScript/React code
Maintain strict TypeScript and avoid using any type
Use PascalCase for component names and camelCase for variables and function names
Use functional components with React hooks instead of class components
Use React context for global state management and TanStack Query for server state management
Run just format, just lint, and just build after making TypeScript/React changes to ensure code quality and compilation

Files:

  • frontend/src/components/UnifiedChat.tsx
⏰ 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). (6)
  • GitHub Check: build-ios
  • GitHub Check: build-macos (universal-apple-darwin)
  • GitHub Check: build-linux
  • GitHub Check: build-android
  • GitHub Check: Greptile Review
  • GitHub Check: Cloudflare Pages
🔇 Additional comments (2)
frontend/src/components/UnifiedChat.tsx (2)

820-823: LGTM! Clean localStorage persistence implementation.

The initialization follows the same pattern as the fullscreen preference above, ensuring consistency. The lazy initialization with useState(() => ...) correctly reads from localStorage only once on mount, and the boolean conversion is properly handled.


836-840: LGTM! Persistence layer correctly implemented.

The useEffect properly syncs the toggle state to localStorage, matching the pattern used for fullscreen mode. The implementation is complete—isWebSearchEnabled is correctly included in the handleSendMessage dependency array (line 2515) and used when creating responses (lines 2250, 2410).


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

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Dec 29, 2025

Greptile Summary

Implemented localStorage persistence for the web search toggle state. The implementation follows the same pattern as the existing fullscreen mode preference, using lazy initialization with useState(() => localStorage.getItem("webSearchEnabled") === "true") and a useEffect hook to persist changes. This ensures users don't need to re-enable web search in each new chat session.

  • Added lazy initialization of isWebSearchEnabled state from localStorage
  • Added useEffect to persist web search toggle state changes to localStorage
  • Uses consistent storage key naming pattern ("webSearchEnabled")
  • Follows existing codebase patterns for user preference persistence

Confidence Score: 5/5

  • This PR is safe to merge with no issues found
  • The implementation exactly mirrors the existing fullscreen persistence pattern, uses the correct React hooks pattern with lazy initialization, and is a minimal focused change with no side effects
  • No files require special attention

Important Files Changed

Filename Overview
frontend/src/components/UnifiedChat.tsx Added localStorage persistence for web search toggle following existing pattern for fullscreen mode

Sequence Diagram

sequenceDiagram
    participant User
    participant Component as UnifiedChat Component
    participant State as React State
    participant LS as localStorage

    Note over Component,LS: Component Mount
    Component->>LS: getItem("webSearchEnabled")
    LS-->>Component: "true" | "false" | null
    Component->>State: Initialize isWebSearchEnabled state
    
    Note over User,LS: User Toggles Web Search
    User->>Component: Click web search toggle
    Component->>State: setIsWebSearchEnabled(!current)
    State-->>Component: State updated
    
    Note over Component,LS: Persist Change
    Component->>Component: useEffect triggered
    Component->>LS: setItem("webSearchEnabled", value.toString())
    LS-->>Component: Stored
    
    Note over Component,LS: Next Session
    Component->>LS: getItem("webSearchEnabled")
    LS-->>Component: Previous preference restored
    Component->>State: Initialize with saved value
Loading

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Dec 29, 2025

Greptile's behavior is changing!

From now on, if a review finishes with no comments, we will not post an additional "statistics" comment to confirm that our review found nothing to comment on. However, you can confirm that we reviewed your changes in the status check section.

This feature can be toggled off in your Code Review Settings by deselecting "Create a status check for each PR".

@AnthonyRonning AnthonyRonning merged commit 01f57d7 into master Dec 29, 2025
7 checks passed
@AnthonyRonning AnthonyRonning deleted the claude/issue-349-20251229-1640 branch December 29, 2025 19:59
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.

Remember web search toggle

2 participants