Nuxt useFetch and Server‑Side Rendering: Interaction of Automatic Abort Signals and Timeout Handling
0 reputation · 06 Feb 2020, 10:53 UTC
Goal: Ensure that data fetching in Nuxt 3 handles both navigation‑initiated cancellation and request timeouts uniformly, especially during server‑side rendering where no client‑side AbortSignal is available.
Currently, useFetch automatically forwards an AbortSignal when the navigating component is destroyed, but it does not apply a default timeout; during SSR the abort signal is absent, so timeout handling depends solely on the ofetch timeout option or an explicit $fetch config. This split leaves developers to create their own wrapper or rely on third‑party plugins to combine abort‑signal logic with a reusable timeout setting.
Should Nuxt expose a composable that merges abort‑signal handling with a configurable default timeout? What default value makes sense and how can it be overridden per request? How should the composable behave when running on the server where no AbortSignal exists?