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
LB-778: Don't clear add-to-playlist search input on blur #1254
Conversation
Is it possible to add tests for this behaviour? |
I'll give it a go |
@brainzbot retest this please my dear |
0daa46d
to
b73f76b
Compare
The solution is: cache everything! Cache the search query and prevent it from being cleared, and cache the ACRM results for that query too. Also don't close the results on select so that users can add multiple songs easily.
Fix a quirk with fontawesome hash ids that make the snapshots different each time.
To solve issue with snapshots and date string formatted with toLocaleString.
Using the previous commit's TZ change
b73f76b
to
f14ee46
Compare
The Playlist component didn't have any tests. I added a standard "page loads OK" test with snapshot comparison and a test for the search input behavior that this PR changes. In the meantime, JS tests are passing (I know it looks like they're not, but that's because we're working on the Jenkins config). |
@brainzbot retest this please |
As [LB-778] mentions, currently in the playlist page when a user loses focus of the add-a-track search input, whatever query they had typed gets cleared.
The reason is that we're using the React-Select library with a bit of an edge use case and the default behavior is to allow searching within the options in the dropdown, rather than fetch API results.
The solution is to cache everything in the state and take manual control of the React-Select component.
Cache the search query and prevent it from being cleared, and cache the search results for that query too.
We also prevent the dropdown from closing when a user selects a result, so that they can easily add multiple songs from those same results.