Desktop: Fix#15147 editor disappearing when search is triggered with empty query#15148
Open
MANVENDRA-github wants to merge 2 commits intolaurent22:devfrom
Open
Desktop: Fix#15147 editor disappearing when search is triggered with empty query#15148MANVENDRA-github wants to merge 2 commits intolaurent22:devfrom
MANVENDRA-github wants to merge 2 commits intolaurent22:devfrom
Conversation
Contributor
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/app-desktop/gui/SearchBar/SearchBar.tsx (1)
135-138: Minor: condition can be simplified.
!query || query.trim().length === 0is redundant — an empty string'strim().lengthis already0, so!query.trim()covers both cases.♻️ Proposed simplification
- if (!query || query.trim().length === 0) { + if (!query.trim()) { focus('SearchBar::onSearchButtonClick', props.inputRef.current); return; }Also worth confirming: if
props.inputRef.currentcan ever benullat this point,focus()should handle it gracefully — please double-check thefocushelper tolerates a null target.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/app-desktop/gui/SearchBar/SearchBar.tsx` around lines 135 - 138, Simplify the empty-query check inside SearchBar::onSearchButtonClick by replacing the redundant condition `!query || query.trim().length === 0` with `!query.trim()` and ensure you reference the same symbols (`onSearchButtonClick`, `props.inputRef.current`, and the `focus` helper); additionally, confirm that `focus` tolerates a null target—if it doesn't, add a null guard around the `focus('SearchBar::onSearchButtonClick', props.inputRef.current)` call to avoid calling it with a null ref.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@packages/app-desktop/gui/SearchBar/SearchBar.tsx`:
- Around line 135-138: Simplify the empty-query check inside
SearchBar::onSearchButtonClick by replacing the redundant condition `!query ||
query.trim().length === 0` with `!query.trim()` and ensure you reference the
same symbols (`onSearchButtonClick`, `props.inputRef.current`, and the `focus`
helper); additionally, confirm that `focus` tolerates a null target—if it
doesn't, add a null guard around the `focus('SearchBar::onSearchButtonClick',
props.inputRef.current)` call to avoid calling it with a null ref.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: e0ade1ec-0f11-4b2a-877d-d763987d4d4e
📒 Files selected for processing (1)
packages/app-desktop/gui/SearchBar/SearchBar.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #15147
Summary:
Fixes an issue where clicking the search button when the search input is small can cause the editor and notes pane to disappear.
Root cause:
Search mode was being activated even when the query was empty. This led to entering a search state with no results, which in certain layouts (e.g., when the sidebar is very narrow) caused the UI to collapse and the editor to disappear.
Fix:
Added a guard in
SearchBar.onSearchButtonClickto prevent entering search mode when the query is empty or whitespace-only. In such cases, the input is focused without dispatchingFOCUS_SETBefore the fix:
Recording.2026-04-19.192512.mp4
After the fix:
Recording.2026-04-19.191537.mp4