Skip to content

fix(knowledge): fix search input flicker on clear and plan display name fallback#3810

Merged
waleedlatif1 merged 1 commit intostagingfrom
fix/misc
Mar 27, 2026
Merged

fix(knowledge): fix search input flicker on clear and plan display name fallback#3810
waleedlatif1 merged 1 commit intostagingfrom
fix/misc

Conversation

@waleedlatif1
Copy link
Copy Markdown
Collaborator

Summary

  • Fix knowledge search input reverting to previous value for 300ms after clicking clear — track searchInputValue separately from debouncedSearchQuery so SearchSection always sees the live value
  • Extract handleSearchClearAll as a stable useCallback instead of an inline arrow inside useMemo
  • Fix planDisplayName in workspace header returning "undefined Plan" when showPlanInfo is false — default to empty string

Type of Change

  • Bug fix

Testing

Tested manually

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Mar 27, 2026 7:21pm

Request Review

@cursor
Copy link
Copy Markdown

cursor bot commented Mar 27, 2026

PR Summary

Low Risk
Low risk UI-only changes: decouples displayed search input state from debounced filtering and tightens a plan name fallback; no auth/data flow changes.

Overview
Fixes the knowledge base search UI so clearing the search immediately clears the input (tracks searchInputValue separately from the debounced query used for filtering) and makes onClearAll a stable callback.

Prevents the workspace header plan label from rendering as "undefined Plan" by returning an empty string when plan info shouldn’t be shown.

Written by Cursor Bugbot for commit e884c1a. Configure here.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 27, 2026

Greptile Summary

This PR fixes two independent bugs: a search input flicker in the Knowledge page, and a stale plan display name computation in the workspace header.\n\n- Search flicker fix (knowledge.tsx): Introduces a dedicated searchInputValue state that updates synchronously on every keystroke and clear action, while debouncedSearchQuery (used for filtering) continues to update after a 300ms debounce. searchConfig.value is now bound to searchInputValue instead of the debounced state, so the input reflects its live value without waiting for the timer. handleSearchClearAll is also extracted into a stable useCallback rather than an inline arrow inside useMemo.\n- Plan display name fix (workspace-header.tsx): Rewrites the planDisplayName ternary to return an empty string when showPlanInfo is false, instead of the previous \" Plan\" (space + "Plan") that could be produced when rawPlanName was an empty string. The value is only rendered inside a {showPlanInfo && ...} guard, so this is a correctness/clarity improvement.\n\nBoth changes are minimal, well-scoped, and carry no risk of regressions.

Confidence Score: 5/5

This PR is safe to merge — both changes are targeted bug fixes with no side effects.

No P0 or P1 issues found. The search fix correctly separates live input state from debounced filter state, and filtering still uses debouncedSearchQuery as intended. The plan name fix is a clean defensive improvement. All remaining observations are P2 or below.

No files require special attention.

Important Files Changed

Filename Overview
apps/sim/app/workspace/[workspaceId]/knowledge/knowledge.tsx Adds a separate searchInputValue state for immediate UI reflection, extracts handleSearchClearAll into a stable useCallback, and passes searchInputValue (not the debounced query) to searchConfig.value — correctly fixes the 300ms flicker on clear.
apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/workspace-header/workspace-header.tsx Refactors planDisplayName ternary to explicitly return '' when showPlanInfo is false, preventing a stale " Plan" string from being computed even though it was already guarded by the {showPlanInfo && ...} render conditional.

Sequence Diagram

sequenceDiagram
    participant User
    participant Input as Search Input
    participant State as searchInputValue
    participant Timer as Debounce Timer
    participant Filter as debouncedSearchQuery

    User->>Input: Types "test"
    Input->>State: setSearchInputValue("test") (immediate)
    Input->>Timer: clearTimeout + setTimeout 300ms
    Timer-->>Filter: setDebouncedSearchQuery("test") [after 300ms]
    Note over Input,State: Input shows "test" immediately

    User->>Input: Clicks Clear
    Input->>State: setSearchInputValue("") (immediate)
    Input->>Timer: clearTimeout + setTimeout 300ms
    Note over Input,State: Input clears immediately (bug fixed)
    Timer-->>Filter: setDebouncedSearchQuery("") [after 300ms]
    Note over Filter: Results fully cleared after 300ms
Loading

Reviews (1): Last reviewed commit: "fix(knowledge): fix search input flicker..." | Re-trigger Greptile

@waleedlatif1 waleedlatif1 merged commit 34df333 into staging Mar 27, 2026
7 checks passed
@waleedlatif1 waleedlatif1 deleted the fix/misc branch March 27, 2026 22:33
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