thombruce / TheDefinitiveEdition

https://thedefinitiveedition.thombruce.com/
GNU General Public License v3.0
0 stars 0 forks source link

[Bug]: Stale search results #7

Open thombruce opened 1 year ago

thombruce commented 1 year ago

What happened?

Items from previous search still show in subsequent searches:

image

This doesn't always happen, but something weird is definitely going on here.

Version

0.1.0 (Default)

What browsers are you seeing the problem on?

No response

Relevant log output

No response

Code of Conduct

thombruce commented 1 year ago

Note that the previous search in the case above was for "Ratchet and Clank a Rift" which yielded, among other results, "Ratchet and Clank: Rift Apart".

I'm not sure why Rift Apart doesn't show here. Something to do with the async nature of the search? Something to do with searches completing and returning results at different times?

Consider applying a standard JavaScript filter to discard erroneous results.

thombruce commented 1 year ago

As well as using an ordinary JS filter on the results returned, we should cache all results received... This prevents a delayed return value from overwriting a new one.

We could use Pinia storage to achieve this... or we could simply push into our search array's reactive object.

When/how do we do cleanup?

I think Vue will handle this just fine when the component is unmounted, so it isn't a major concern... unless we do use Pinia, in which case we need to drop the values on unmount ourselves.

Apart from which, we can use the result of the JS filter to cleanup unmatched results... those this has a major caveat if fuzzy searching is involved. Probably won't be a problem.