Skip to content

Fix music search only returning results for the first typed letter - #1730

Open
csaavedra wants to merge 1 commit into
finamp-app:legacyfrom
csaavedra:fix/search-debounce
Open

csaavedra wants to merge 1 commit into
finamp-app:legacyfrom
csaavedra:fix/search-debounce

Conversation

@csaavedra

Copy link
Copy Markdown

Typing a query like "Nirvana" in the music search bar returned results for just "N". Every keystroke called PagingController.refresh(), but infinite_scroll_pagination coalesces refreshes for the same page key: while a "page 0" request is in flight it issues no new request. As a result only the first keystroke's term was ever fetched, and its (first-letter) results were all that showed once the slow response arrived.

Debounce the search field so a single query is issued for the final term once the user pauses typing, instead of one request per keystroke.

As a safety net for burst typing (a pause mid-word can still start a request for a partial term while a later refresh gets coalesced away), _getPage now appends the response before checking staleness and, if the term changed while the request was in flight, triggers a refresh so the current term actually gets fetched. Appending first is required: the controller won't issue a new request until the in-flight one completes, so dropping the result would leave the list stuck on a spinner.

Fixes #1729

Typing a query like "Nirvana" in the music search bar returned results
for just "N". Every keystroke called PagingController.refresh(), but
infinite_scroll_pagination coalesces refreshes for the same page key:
while a "page 0" request is in flight it issues no new request. As a
result only the first keystroke's term was ever fetched, and its
(first-letter) results were all that showed once the slow response
arrived.

Debounce the search field so a single query is issued for the final
term once the user pauses typing, instead of one request per keystroke.

As a safety net for burst typing (a pause mid-word can still start a
request for a partial term while a later refresh gets coalesced away),
_getPage now appends the response before checking staleness and, if the
term changed while the request was in flight, triggers a refresh so the
current term actually gets fetched. Appending first is required: the
controller won't issue a new request until the in-flight one completes,
so dropping the result would leave the list stuck on a spinner.

Fixes finamp-app#1729
@Chaphasilor

Copy link
Copy Markdown
Member

@csaavedra hey, thanks for the fix but this should already be fixed on the redesign branch / the beta version. Have you look at that yet? :)
We're planning to release that to stable by the end of the month

@csaavedra

Copy link
Copy Markdown
Author

No, I haven't. I am reluctant to use "beta"-tagged software. I guess I will wait until the end of the month; I am using my own build with this fix in the meantime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Search shows outdated query results when typing over slow network

2 participants