Skip to content
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

Merged
merged 7 commits into from Feb 10, 2021

Conversation

MonkeyDo
Copy link
Contributor

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.

@paramsingh
Copy link
Collaborator

Is it possible to add tests for this behaviour?

@MonkeyDo
Copy link
Contributor Author

Is it possible to add tests for this behaviour?

I'll give it a go

@MonkeyDo
Copy link
Contributor Author

MonkeyDo commented Feb 3, 2021

@brainzbot retest this please my dear

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
@MonkeyDo
Copy link
Contributor Author

MonkeyDo commented Feb 4, 2021

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.
I'll open a ticket about creating more tests.

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).
As for Unit and Integration tests randomly failing… ¯_(ツ)_/¯
Let's ask @brainzbot retest this please

@MonkeyDo
Copy link
Contributor Author

@brainzbot retest this please

@MonkeyDo MonkeyDo merged commit bdbd055 into master Feb 10, 2021
@MonkeyDo MonkeyDo deleted the add-to-playlist-search-input branch February 10, 2021 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants