Skip to content

fix(web): scope file-search recents by revision#1417

Open
rachit367 wants to merge 2 commits into
sourcebot-dev:mainfrom
rachit367:rachit367/fix-file-search-recents-revision
Open

fix(web): scope file-search recents by revision#1417
rachit367 wants to merge 2 commits into
sourcebot-dev:mainfrom
rachit367:rachit367/fix-file-search-recents-revision

Conversation

@rachit367

@rachit367 rachit367 commented Jul 2, 2026

Copy link
Copy Markdown

Fixes #1387

Problem

The browse file-search dialog stores recently opened files under recentlyOpenedFiles-${repoName} — keyed by repository only. Switching branches/revisions in the same repo still shows recents from the other revision, and selecting one navigates with the current revision, which can point at a path that doesn't exist there (confusing dead-end navigation).

Fix

revisionName is already available from useBrowseParams() in the same component, so scope the localStorage key by revision as well: recentlyOpenedFiles-${repoName}@${revisionName ?? 'HEAD'}. The ?? 'HEAD' default matches how the rest of browse (useBrowseNavigation, fileTreePanel) resolves the default revision, so the default-branch recents key stays stable.

One-line change in fileSearchCommandDialog.tsx; tsc --noEmit is clean for the web package.

Summary by CodeRabbit

  • Bug Fixes
    • Recently opened files in file search are now scoped to the current revision, preventing items from showing up across branches.
    • The file search recents list now stays aligned with the active revision for a more accurate browsing experience.
  • Documentation
    • Updated the changelog with the latest fix.

rachit367 added 2 commits July 2, 2026 14:04
The browse file-search recents were stored under recentlyOpenedFiles-${repoName},
so switching branches showed recents from another revision, and selecting one
could navigate to a path that doesn't exist there. Scope the key by revision
(defaulting to HEAD, matching the rest of browse) so recents don't leak across
revisions.

Fixes sourcebot-dev#1387
@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 25f1b266-9d0b-4c7f-9907-79e191781406

📥 Commits

Reviewing files that changed from the base of the PR and between fd6720f and ab04bbf.

📒 Files selected for processing (2)
  • CHANGELOG.md
  • packages/web/src/app/(app)/browse/components/fileSearchCommandDialog.tsx

Walkthrough

The recentlyOpened localStorage persistence key in FileSearchCommandDialog is updated to include the current revision name (defaulting to HEAD) in addition to the repository name, and a corresponding changelog entry is added.

Changes

Recent Files Storage Key

Layer / File(s) Summary
Scope storage key by revision
packages/web/src/app/(app)/browse/components/fileSearchCommandDialog.tsx, CHANGELOG.md
The useLocalStorage key for recentlyOpened is changed from repo-scoped to repo+revision-scoped (repoName@<revision or HEAD>), and a changelog entry documents the fix to prevent cross-branch leakage of recently opened files.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Possibly related PRs

  • sourcebot-dev/sourcebot#341: Both PRs touch fileSearchCommandDialog.tsx, with this PR building directly on the "recently opened" persistence logic introduced there.

Suggested reviewers: brendan-kellam

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: scoping file-search recents by revision.
Linked Issues check ✅ Passed The change scopes recently opened files by revisionName and matches the issue’s expected behavior.
Out of Scope Changes check ✅ Passed The only extra change is a changelog note, which is directly related to the revision-scoping fix.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

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.

File search recents are shared across browse revisions

1 participant