DEV Community

mohammad garmabi
mohammad garmabi

Posted on

tanstack-fetch 1.7.0 — Solid / Angular / Svelte adapters + doctor CLI


If you use TanStack Query, your queryFn wants: return data, throw on error, honor AbortSignal.

tanstack-fetch 1.7.0 ships real adapters for Solid, Angular, and Svelte (parity with React/Vue), a doctor CLI, more migrate scaffolds, onDownloadProgress, and docs that filter by framework.

Not an official TanStack package — shaped for the same Query API.

Upgrade

npm install tanstack-fetch@1.7.0
Enter fullscreen mode Exit fullscreen mode

Adapters

import { useSse } from 'tanstack-fetch/solid'
// or tanstack-fetch/svelte · tanstack-fetch/angular
Enter fullscreen mode Exit fullscreen mode
Import API
tanstack-fetch/solid FetchProvider, useFetch, useSse
tanstack-fetch/svelte setFetchClient, useFetch, useSse
tanstack-fetch/angular provideFetchClient, injectFetch, useSse

Doctor + migrate

npx tanstack-fetch doctor --dir ./src
npx tanstack-fetch migrate --from axios --framework solid --write
npx tanstack-fetch migrate --from fetch --framework sveltekit --write
Enter fullscreen mode Exit fullscreen mode

Download progress

await api.get('/files/report.pdf', {
  parseAs: 'blob',
  onDownloadProgress: ({ progress, loaded, total }) => console.log(progress, loaded, total),
})
Enter fullscreen mode Exit fullscreen mode

Links

Top comments (0)