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

Fix outdated search results #183

Merged
merged 1 commit into from
Dec 22, 2021
Merged

Fix outdated search results #183

merged 1 commit into from
Dec 22, 2021

Conversation

DeD1rk
Copy link
Member

@DeD1rk DeD1rk commented Dec 20, 2021

This fixes a problem where incorrect search results may appear. When an api call was triggered, its result was used even if during the asynchronous gap, something changes such that the result should no longer be used. For example:

  • When searching for 'a', a timer is started.
  • After 300ms, an http request is sent.
  • Before the corresponding response is received, the user removes the query, so the state should remain loading.
  • The response arrives, and handling of the old 'a' search continues, emitting a new incorrect state.

This PR eliminates the problem by discarding a response if the search query has changed. Note that exceptions thrown in the api call will still result in an exception state being emitted.

@DeD1rk DeD1rk force-pushed the fix-outdated-search-results branch from c9a7a71 to c85fd86 Compare December 20, 2021 13:36
@DeD1rk DeD1rk force-pushed the fix-outdated-search-results branch from c85fd86 to d75cea8 Compare December 20, 2021 13:37
@DeD1rk DeD1rk requested review from rowan-vr and LCKnol December 20, 2021 15:12
@DeD1rk DeD1rk merged commit 57c9b90 into master Dec 22, 2021
@DeD1rk DeD1rk deleted the fix-outdated-search-results branch December 22, 2021 19:53
rowan-vr pushed a commit that referenced this pull request Feb 2, 2022
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.

2 participants