server functions cancellation

hii
i've added signal.throwIfAborted() to my server function, and then i call it with the router's AbortController instance:
loader: ({ abortController }) => cancellableFn({ signal: abortController.signal })

but when i navigate to another page while this one loads, i'm getting the following error:
Server Fn Error!

DOMException [AbortError]: This operation was aborted
    at new DOMException (node:internal/per_context/domexception:76:18)
    at AbortController.abort (node:internal/abort_controller:506:18)
    at AbortSignal.abort (/Users/dubzer/repos/web/node_modules/.pnpm/@tanstack+start-server-core@1.139.14_crossws@0.4.1_srvx@0.8.7_/node_modules/@tanstack/start-server-core/src/server-functions-handler.ts:24:34)


wouldn't it make more sense to simply suppress the error when the cancellation is initiated by the router?
i mean, at that point as a user, you don't care about the result of the function anyway. but the router knows that the function was aborted, so it can expect that error

thanks!
Was this page helpful?