Allow media store to cancel previous media-fetch requests if a new one is sent before the previous is completed #598
Labels
🕹 aspect: interface
Concerns end-users' experience with the software
✨ goal: improvement
Improvement to an existing user-facing feature
🟩 priority: low
Low priority and doesn't need to be rushed
🧱 stack: frontend
Related to the Nuxt frontend
Problem
It's currently possible to cause a race condition in search. If you submit query A and then immediately submit query B, if the API takes longer to return A than it takes to send and return B, then B will come back before A, sent to the store, and then be replaced by the response to A.
Description
Axios supports
AbortController
so it shouldn't be too bad to use an abort controller entry in the media store as a "lock" on the search execution that is forcefully released each time a new search is executed.Alternatives
Prevent sending requests in the UI by blocking new requests while existing ones are still evaluating... This seems like a bad UX though.
Implementation
The text was updated successfully, but these errors were encountered: