sourcegraph / sourcegraph-public-snapshot

Code AI platform with Code Search & Cody
https://sourcegraph.com
Other
10.11k stars 1.29k forks source link

Fuzzy finder: make focusIndex state persistent across blob views #22221

Open olafurpg opened 3 years ago

olafurpg commented 3 years ago

Steps to reproduce:

  1. Activate fuzzy finder in sourcegraph/sourcegraph
  2. Search for "helper"
  3. Press down arrow
  4. Press enter
  5. Activate fuzzy finder again

Expected behavior: the focused filename should be the second filename in the result list for the query "helper"

Actual behavior: the focused filename has been reset to the first filename in the list.

This bug is caused by the fact that the focusItem state is part of the FuzzyModal component instead of FuzzyFinder.

https://github.com/sourcegraph/sourcegraph/blob/41d2a8c7eb192e2a927ab5147b44bc387ee1ef58/client/web/src/components/fuzzyFinder/FuzzyModal.tsx#L67-L70

/cc @felixfbecker

github-actions[bot] commented 3 years ago

Heads up @macraig - the "team/code-intelligence" label was applied to this issue.