finamp icon indicating copy to clipboard operation
finamp copied to clipboard

When searching for album/artist/etc, shown result may match previous query

Open josteink opened this issue 11 months ago • 6 comments

Consider the following example:

I want to listen to the album "Xen cuts", a compilation album from Ninja Tune label. I open FinAmp, click "Albums" tab, and enter "X", "e" and "n", forming the saerch "Xen". I'm a fast typer, so I manage to type the "n" before the search results from "Xe" is fully returned.

When I'm done typing "Xen", the search results looks like this: image

What we're looking at here is probably the search results for "Xe", not "Xen".

As a programmer, I would assume the following has happened:

  • I type "X", a search-request is issued (Req1)... awaiting the response Res1.
  • I type "e", a search-request is issued (Req2)... awaiting the response Res2.
  • Response Res1 is received, UI is updated, regardless.
  • I type "n", a search-request is issued (Req3) is issued... awaiting the response Res3.

Now here's what I belive is the juicy bit.

Req2 will probably take more time to execute and return a bigger result set than Req3, because Req3 by definition is narrower. This means that Req3, despite being issued later, may actually return earlier than Req2.

Which if I'm correct yields the following:

  • Response Res3 is received before Res2, UI is updated, regardless.
  • Response Res2 is received, UI is updated, regardless, even though this was not the latest search.

What I as a user expect is that the result shown always matches the latest search. Basically when a new search query is issued, the response from all previous search queries should be disregarded.

josteink avatar Mar 21 '24 09:03 josteink

Is this in 0.6.2? Because I think the redesign beta should have a fix for this already.

Komodo5197 avatar Mar 21 '24 14:03 Komodo5197

This is 0.6.20 on MacOS, yes.

Whats the best way for me to test the beta redesign?

josteink avatar Mar 21 '24 15:03 josteink

Yeah this isn't fixed in the beta either. I have to work around it myself quite often, where I just wait with the final character until after the search results loaded, and then enter it to trigger a new search.

I'm definitely planning to fix that, but will probably only do this as part of the general search overhaul (so search isn't tied to specific categories by default anymore). If I have the time and motivation I might try to fix this earlier, but I can't say for sure.
I'd be happy to accept a nice pull request though!

Chaphasilor avatar Mar 21 '24 17:03 Chaphasilor

@Chaphasilor Are you sure? I tried to fix this when I was reworking the music screen paging in the downloads rewrite, and I can't recreate this on 0.9.3.

Komodo5197 avatar Mar 21 '24 18:03 Komodo5197

Oh! No I'm not sure, and I completely missed those changes. I'll try not updating my search in the coming days to see if it works or not :D

Chaphasilor avatar Mar 21 '24 18:03 Chaphasilor

@Komodo5197 you're right, the bug with old search results popping up isn't there anymore. But to me it feels much slower than before. I'll keep an eye on it.

Chaphasilor avatar Mar 30 '24 22:03 Chaphasilor