v2.2.8
This bugfix release fixes a long-standing issue with RTK Query lazy query triggers returning stale data in some cases, fixes an error handling issue in RTK Query, and exports additional TS types.
Changelog
Lazy Query Trigger Handling
We'd had a couple long-standing issues reporting that const result = await someLazyQueryTrigger() sometimes returned stale data, especially if a mutation had just invalidated that query's tag.
We finally got a good repro of this issue and identified it as a mis-written call inside of the middleware that skipped past the necessary handling to activate the correct query status tracking in that scenario. This should now be fixed.
Other Changes
Timeout handling in RTKQ endpoints should now correctly throw a timeout-related error instead of an AbortError.
Base queries now have access to the current queryCacheKey value so it can be used in deciding query logic.
We've exported several more TS types related to query options, as some users have been depending on those even though they previously weren't part of the public API.
What's Changed
- Export
QueryExtraOptionsandMutationExtraOptionsby @aryaemami59 in #4556 - Fix
mangleErrorsnot preserving different error types by @aryaemami59 in #4586 - Add the
TypedUseQueryStateOptionshelper type by @aryaemami59 in #4604 - feat(baseQuery): expose queryCacheKey in baseQuery by @HaakonSvane in #4636
- Fix
AbortErrorbeing triggered incorrectly oncreateApiendpoint timeout by @andrejpavlovic in #4628 - type: export QueryReturnValue by @hornta in #4640
- call
initiateto refetch queries from middleware by @phryneas in #4651
Full Changelog: v2.2.7...v2.2.8