S
SolidJS9mo ago
gabriel

Does Solid Router's APIs provide any way to abort a pending submission?

My issue is that I want to do optimistic updates, but if the user decides to change things way too fast, there will probably be some flickering, or the last value they had will not be the one on the database. I could also debounce the call to the action to avoid it being called multiple times, but even there this wouldn't be optimal. I know that I can certainly have a form and use the action there instead of calling and then abort the requests that are pending before the form submits by using the window.stop, but then the problem is that, because I have multiple small actions the user can do, a abortion meant for a certain action would end up aborting the other form action. I'm not sure if Solid internally handles the actions using a fetch (I am using start so it might be more related to vinxi), but if it does, the best for me would to be able to pass in an AbortController to it. I also tried using the submission.clear function but that only clears the underlying data about the submission, it doesn't actually abort the request. Has anyone thought about something like this? Would love to know if you were able to fix this or not. What kind of approaches you've taken.
1 Reply
gabriel
gabrielOP9mo ago
I'm thinking that if start doesn't provide a clear way to abort the server action, my best shot is going to be debouncing the action calls
Want results from more Discord servers?
Add your server