Bump @reduxjs/toolkit from 1.8.3 to 1.8.5
Bumps @reduxjs/toolkit from 1.8.3 to 1.8.5.
Release notes
Sourced from @reduxjs/toolkit
's releases.
v1.8.5
This bugfix releas fixes an issue with large
keepUnusedDataFor
values overflowing JS timers, exports the types for the Redux DevTools Extension option, and and improves behavior of URL string generation.Changelog
keepUnusedDataFor
Timer Fix
keepUnusedDataFor
accepts a value in seconds. When there are no more active subscriptions for a piece of data, RTKQ will set a timer usingsetTimeout
, andkeepUnusedDataFor * 1000
as the timer value.We've been advising users that if they want to keep data in the cache forever that they should use a very large value for
keepUnusedDataFor
, such as 10 years in seconds.However, it turns out that JS engines use a 32-bit signed int for timers, and 32-bits in milliseconds is only 24.8 days. If a timer is given a value larger than that, it triggers immediately.
We've updated the internal logic to clamp the
keepUnusedDataFor
value to be between 0 andTHIRTY_TWO_BIT_MAX_TIMER_SECONDS - 1
.Note that in RTK 1.9 (coming soon), RTKQ will also accept
Infinity
as a specialkeepUnusedDataFor
value to indicate cached data should never be expired.Other Changes
RTK inlines the TS types for the Redux DevTools Extension options to avoid an extra dependency, but the TS type for the options object wasn't exported publicly. We now export the
DevToolsEnhancerOptions
type.The logic for generating a final URL has been updated to avoid adding an extra trailing
/
.What's Changed
- Prevent
keepUnusedDataFor
values from overflowingsetTimeout
counter by@markerikson
in reduxjs/redux-toolkit#2595- remove typeof undefined checks where not necessary
🐃 🪒 by@phryneas
in reduxjs/redux-toolkit#1726- Update RDT options types, and export those + AnyListenerPredicate by
@markerikson
in reduxjs/redux-toolkit#2596- Ensures there is no unexpected slash in url before query params by
@ygrishajev
in reduxjs/redux-toolkit#2470Full Changelog: https://github.com/reduxjs/redux-toolkit/compare/v1.8.4...v1.8.5
v1.8.4
This bugfix release adds exported TS types for RTKQ hooks for use in wrapping logic, adds
useDebugValue
to the hooks to improve display in the React DevTools, updates the inlined types for the Redux DevTools options, and fixes an issue increateEntityAdapter
that could result in duplicate IDs being stored.Changelog
RTKQ Hook Result Types
RTK's types heavily rely on inference to minimize the amount of type info users have to provide. However, this can also make it difficult to write functions that wrap calls to RTK APIs.
Some users have asked to have types that help them write "higher-order hooks". RTK now exports types that represent "the return object for a query/mutation hook with a given value":
TypedUseQueryHookResult
andTypedUseMutationResult
. Both require<ResultType, QueryArg, BaseQuery>
as generics, like this:const baseQuery = fetchBaseQuery({url: "https://some.server"}); type CustomHookResult = TypedUseQueryHookResult<MyResultObject, MyArgObject, typeof baseQuery> const useMyCustomHook = (arg: MyArgObject) : CustomHookResult => { </tr></table>
... (truncated)
Commits
-
4ab8c42
Release 1.8.5 -
ceb3d50
Ensures there is no unexpected slash in url before query params (#2470) -
4822769
Merge pull request #2610 from NiedziolkaMichal/patch-1 -
37e3c59
Add caseReducers & getInitialState to createSlice docs -
448607a
Merge pull request #2596 from reduxjs/feature/export-more-ts-types -
ddef7c4
Update RDT options types, and export those + AnyListenerPredicate -
88692ae
Merge pull request #1726 from reduxjs/pr/remove-typeof -
3bd595b
remove typeof undefined checks where not necessary🐃 🪒 -
dc673a3
Merge pull request #2595 from reduxjs/bugfix/settimeout-max-value -
e67b93d
PreventkeepUnusedDataFor
values from overflowingsetTimeout
counter - Additional commits viewable in compare view
Dependabot commands
You can trigger Dependabot actions by commenting on this MR
-
$dependabot rebase
will rebase this MR -
$dependabot recreate
will recreate this MR rewriting all the manual changes and resolving conflicts