Releases: redux-saga/saga-query
Releases · redux-saga/saga-query
v9.0.2
v9.0.1
Full Changelog: v9.0.0...v9.0.1
v9.0.0
What's Changed
- feat: export resetLoaders action by @ElForastero in #33
- fix: dont automatically set content type for fetcher()
- BREAKING CHANGE:
headersMdw
fromfetcher()
is now opt-in
New Contributors
- @ElForastero made their first contribution in #33
Full Changelog: v8.0.0...v9.0.0
ctx.loader no longer requires `id`
Full Changelog: v7.3.0...v8.0.0
invalidate cache mechanism
Full Changelog: v7.2.2...v7.3.0
properly memoize react hooks
v7.2.2 fix: memoize react hooks properly
ensure support `yield* next()`
v7.2.1 chore: ensure `yield* next()` works as expected
`fetchRetry` middleware
feat(fetcher): retry middleware (#29) A new middleware for retrying fetch requests when `response.ok` is `false`. This middleware was designed to work on a per-endpoint basis. This means that it should be added immediately after the endpoint function. ``` import { createApi, requestMonitor, fetcher, fetchRetry } from 'saga-query'; const api = createApi(); api.use(requestMonitor()); api.use(api.routes()); api.use(fetcher()); const fetchUsers = api.get('/users', [ function* (ctx, next) { // ... yield next(); // ... }, fetchRetry(), ]) ``` It also supports a backoff function as a parameter. The function signature is `(attempt: number) => number`, the result of which is how long to delay the next fetch attempt. If a negative number is provided then we stop retrying.
Ability to represent any body format for `Response()`
This release makes it possible to represent the body of Response()
in any supported format by the Fetch
API.
const fetchUsers = api.get('/users', function*(ctx, next) {
ctx.bodyType = 'text'; // calls `Response.text()` instead of default `Response.json()`
yield next();
});
typed-redux-saga
This is a breaking change for anyone using saga-query
. We are now using typed-redux-saga
which means anytime you import effects (e.g. call, select, put, etc.) from saga-query
you must use yield delegates.
Before
import { call } from 'saga-query';
function* gen() {
return 0;
}
function*() {
// ts considers result is `any`
const result = yield call(gen);
}
After
import { call } from 'saga-query';
function* gen() {
return 0;
}
function*() {
// ts considers result is `number`
const result = yield* call(gen);
}