serverFn signal is always aborted on POST?
I have this server function:
which I called with a standard queryFn:
So far so good. when the query is called it logs aborted: false as expected. However, if I switch method to "POST", something weird happens:
On the first fetch, when called in a loader from the server, aborted is still false. But when I refetch the query from the client, I see aborted: true. Is this a bug?
9 Replies
solid-orangeOP•5mo ago
forked an example sandbox that reproduces the issue (modified src/utils/posts serverFn).
Go to /posts, and then trigger a refetch query the query devtools, you should see the same as I describe above
I can open an issue on github if this is indeed a bug and not me failing to understand something 😄
genetic-orange•5mo ago
GitHub
Server Fn Signal and API route (request.signal) does not actually f...
Which project does this relate to? Start Describe the bug When canceling a server function or fetch to API Route, either by abortController.abort() or by refreshing / closing the tab to disconnect....
solid-orangeOP•5mo ago
ah yes looks like it, although the issue reports the symptom slightly different. I added a comment with what I believe is the root issue (serverFn signal is always aborted when POST and called from client). Thanks for the link!
flat-fuchsia•4mo ago
Seeing the same thing: Logging signal.aborted the first thing in the createServerFn handler shows it's true right away. Does not matter what the client does, or whether it passes down its own signal.
genetic-orange•4mo ago
i did not yet try on the alpha branch, did anyone?
solid-orangeOP•4mo ago
i did, iirc the signal does not start aborted on the server fn now, but aborting it on the client has no effect (it never aborts on the backend), i can make a repro repo esrly next week
genetic-orange•4mo ago
yes please
solid-orangeOP•4mo ago
@Manuel Schiller
https://github.com/alvarosevilla95/tss-bug-repros/blob/signal-bug/src/routes/index.tsx
or as a sandbox
seems like what I described still holds, the signal does not start aborted, but doesn't react to an abort from the client
genetic-orange•4mo ago
thanks