-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
Describe the problem
As I understand it, when a remote function fires on the client, it's actually a fetch wrapper. I have a case where I have to call a remote whenever an input changes to search for something, as the user types. Now this is an obvious race condition, depending on how flaky the network decides to be, so I need to cancel a request as soon as the user changes the input, so that old requests don't mess up my result section.
Now I could just make a REST api and just manually fetch it, making it possible to use abort signals, but surely there should be some way for a remote function to be able to receive an abort signal. I've tried to search in the docs, but I couldn't find a way to do it, at least not an obvious one.
Describe the proposed solution
The most straightforward way is to have a config object that would contain some options for the underlying fetch call, one of which would be the abort signal. Otherwise make the remote functions abortable directly, somehow
Alternatives considered
Like I said, a classic api with a manual fetch in sveltekit, but now that we have remote function, they should technically replace all that nonsense.
Importance
nice to have
Additional Information
No response