Fix: branch/repo dropdown reset on click#12501
Conversation
|
Hello @abhayymishraa, Thank you for your work on this pull request. Could you please add tests to cover the changes you’ve introduced? This will help ensure the behavior is well validated and prevent potential regressions in the future. Please let us know if you need any support or clarification while adding the tests. Thank you very much! 🙏 |
|
Sure @hieptl |
|
Hi @hieptl , tests are failing because of the main branch test cases are failing |
|
Hello @abhayymishraa, I will review this pull request tomorrow. Thank you very much! 🙏 |
|
Thank You @hieptl |
|
Hi @hieptl any update |
| // Mock the repository data hook | ||
| const mockUseRepositoryData = vi.fn(); | ||
| vi.mock( | ||
| "../../../../src/components/features/home/git-repo-dropdown/use-repository-data", |
There was a problem hiding this comment.
question: Would it be possible to use a pattern like this? Thank you! 🙏
vi.mock("#/components/.../use-repository-data", ...)There was a problem hiding this comment.
sorry sorry, tab completion did that, will fix it
|
@hieptl updated according to you! |
|
Thank you! 🙏 |
Summary of PR
This PR fixes cursor position jumping and input resetting issues in the branch and repository dropdown components.
Changes:
Cursor position fix: Uses direct
onChangehandler instead of downshift'sonInputValueChangeto preserve cursor position when editing in the middle of input text (addresses downshift issue #217)Dropdown stability fix: Added
stateReducerto both dropdowns to prevent dropdown from closing when clicking on the input field while it's openInput sync fix: Simplified
useEffectlogic to only sync input value with selected item when dropdown is closed, preventing text reset while user is typingDemo Screenshots/Videos
Screen.Recording.2026-01-20.at.3.00.01.PM.mov
Change Type
Checklist
Fixes
Resolves #12419
Release Notes
Fixed cursor jumping to end of input when editing branch or repository names in dropdown search fields.