-
Notifications
You must be signed in to change notification settings - Fork 14.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: remove loading indicator when typing in select #18799
Conversation
8feb434
to
c5a8317
Compare
09012c8
to
4a8333f
Compare
Codecov Report
@@ Coverage Diff @@
## master #18799 +/- ##
==========================================
- Coverage 66.58% 66.58% -0.01%
==========================================
Files 1641 1641
Lines 63533 63538 +5
Branches 6424 6428 +4
==========================================
+ Hits 42303 42305 +2
- Misses 19551 19553 +2
- Partials 1679 1680 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
@ktmud I found some problems while testing. The loading indicator is different when we open the select vs when we search for something. Screen.Recording.2022-02-23.at.1.44.25.PM.movThe loading spinner is showing after searching and clicking outside the Select. When Screen.Recording.2022-02-23.at.1.55.35.PM.mov |
4a8333f
to
d8f3cce
Compare
@michael-s-molina Thanks for testing! I've fixed both issues. |
@ktmud I just tested it again and the bugs are still happening. Did you forget to commit something? I also noticed that you removed the Screen.Recording.2022-02-25.at.9.03.22.AM.mov |
@michael-s-molina are you sure you pulled the latest changes? The bugs are fixed for me.
|
This part is not debounced:
|
It's not really expensive. The goal of this whole PR is to make the select options update more responsively to user inputs, which is achieved by separating initial filtering and menu state updates with debounced async requests. |
Screen.Recording.2022-02-28.at.4.44.13.PM.mov |
You can see the loading indicator flicking while you type because it's updating the loading state for every key typed. Screen.Recording.2022-02-28.at.4.55.19.PM.mov |
@michael-s-molina I can reproduce the bug now. Looks like this might need a larger refactoring than I thought it needed. Thanks for testing! |
2f5647b
to
1d69a28
Compare
@michael-s-molina This should be ready for re-review. |
1d69a28
to
93c02b5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The allowNewOptions
is not working as intended. If you add a new option and then search for it then it will disappear from the options.
Screen.Recording.2022-03-02.at.9.38.08.AM.mov
93c02b5
to
e4ae742
Compare
This should have been fixed |
/testenv up |
@geido Ephemeral environment spinning up at http://34.217.29.213:8080. Credentials are |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't found any other problems while testing. Thank you so much @ktmud for improving the user experience of the component and for addressing all suggestions.
@geido was doing some tests with real data so I would kindly request to wait for his approval as well before merging the PR given the critical nature of the component.
optionsArray.find(x => | ||
typeof x === 'object' ? x.value === value : x === value, | ||
) !== undefined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
optionsArray.find(x => | |
typeof x === 'object' ? x.value === value : x === value, | |
) !== undefined | |
optionsArray.find(option => | |
typeof option === 'object' ? option.value === value : option === value, | |
) !== undefined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general I prefer to use x
in these one liners because sometimes you may want to rename the iterable variable as well.
Ephemeral environment shutdown and build artifacts deleted. |
(cherry picked from commit 5a8eb09)
SUMMARY
Remove the loading indicator in select option menus when users are typing and (some) options are already loaded. The loading indicator showing up as users type was added in #16531, while tackling the issue of the inaccurate "No data" message when data is still loading. But we shouldn't show "Loading..." when there are already filtered options available. Removing this unnecessary loading indicator makes the control feels faster.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Before
The "Loading..." option shows up as soon as users type, even when all options are loaded:
After
No "Loading..." option when users start to type, but there is a loading indicator in the input and all filtered options will show up after actual loading is finished:
When all options are loaded for a specific search string, there is no loading indicator at all and no excessive requests will be fired.
TESTING INSTRUCTIONS
npm run storybook
insuperset-frontend
ADDITIONAL INFORMATION