Replies: 4 comments 1 reply
|
There is @solid-primitives/fetch that allows you to make a request abortable via its composable |
|
This has always confused me a little. Isn't it too late to cancel at that point? Like the request has gone out. You don't want it to affect your app, but like that ship has sailed. |
|
Not sure if it's too late to add something to this discussion, but here's a scenario that might help illustrate the issue. Imagine the server API is very slow — the initial request takes several seconds to complete. During that time, the user types something or changes a filter, which triggers a new API call. Both requests reach the server, and both eventually respond, but the first one takes longer to process on the client side. As a result, the first (older) response may arrive after the second (newer) one, causing the UI to show outdated data — the opposite of what the user expects. Ideally, we should be able to cancel or abort previous requests so that outdated responses don't overwrite the results of the most recent request. Of curse this only makes sense if the promise is also cancelable, or has a way to reject previous resolves |
|
We now have |
Uh oh!
There was an error while loading. Please reload this page.
Use case: Auto cancel ajax request on dispose.
All reactions