Skip to content

fix(sessions): discard stale search results on query change (#387)#407

Open
simplast wants to merge 1 commit into
fathah:mainfrom
simplast:fix/sessions-search-race-387
Open

fix(sessions): discard stale search results on query change (#387)#407
simplast wants to merge 1 commit into
fathah:mainfrom
simplast:fix/sessions-search-race-387

Conversation

@simplast

@simplast simplast commented May 27, 2026

Copy link
Copy Markdown

Fix stale session search results in Sessions view (#387)

In-flight searchSessions calls could resolve after the user changed or cleared the query, writing outdated results back into state and leaving previous search cards visible.

This fix:

Tracks the active query with a ref and ignores stale async responses
Introduces settledQuery so results render only when they match the current input
Clears search state synchronously on input change
Refactors content rendering into explicit view states
Adds regression tests for clear, query switch, and late-resolve races
Fixes #387

Track the active query with a ref and settledQuery so in-flight searchSessions
promises cannot repopulate or display results for a previous search. Refactor
Sessions content rendering into explicit view states for easier debugging.

Co-authored-by: Cursor <cursoragent@cursor.com>
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.

[BUG] Clearing search query in Sessions view fails to restore list, and subsequent search results render with broken horizontal layout (Sessions view)

1 participant