Update dependency reselect to v4.1.2 - autoclosed
This MR contains the following updates:
Package | Change | Age | Adoption | Passing | Confidence |
---|---|---|---|---|---|
reselect | 4.1.0 -> 4.1.2 |
Release Notes
reduxjs/reselect
v4.1.2
This release updates the TS types to avoid TypeScript recursion limitations and improve backwards compatibility, adds doc comments to most of the TS types and field declarations, and fixes a bug with the behavior of the resultEqualityCheck
option in defaultMemoize
.
Changelog
TypeScript Updates
We saw cases where composition of selectors past 8-9 levels of nesting would cause TS to fail with a "Type instantiation is excessively deep and possibly infinite" error.
We've updated the types to allow additional recursion up to about 15 levels of nested selectors. Hopefully this is enough for most usages :)
The OutputSelector
generic arguments had been swapped during the rewrite for 4.1, which made it incompatible with other code that attempted to import and use that type. We've reverted the generic arguments to their previous order to fix compatibility.
defaultMemoize
adds a .clearCache()
field to its return value. While the real caching is done by the memoizedResultFunc
function, the actual returned selector has also been run through the memoizer and thus also has a .clearCache()
field attached, but that wasn't captured in the types. We've updated the types to reflect that.
We've also added doc comments to almost all of the internal types for clarity, as well as comments to the returned fields on selectors.
resultEqualityCheck
Behavior
The resultEqualityCheck
option wasn't saving the result if there was a cache hit, which is now fixed.
What's Changed
- Update defaultMemoize cache even if resultEqualityCheck is a hit by @tetslee in https://github.com/reduxjs/reselect/pull/535
- Make OutputSelector backwards compatible w/ < 4.1.0 version by @eXamadeus in https://github.com/reduxjs/reselect/pull/536
- Clarify description of createSelector by @acrollet in https://github.com/reduxjs/reselect/pull/539
- Clean up OutputSelector typing and fix bug with memoize function types by @eXamadeus in https://github.com/reduxjs/reselect/pull/537
New Contributors
- @tetslee made their first contribution in https://github.com/reduxjs/reselect/pull/535
- @acrollet made their first contribution in https://github.com/reduxjs/reselect/pull/539
Full Changelog: https://github.com/reduxjs/reselect/compare/v4.1.1...v4.1.2
v4.1.1
This releases fixes several TS issues and one runtime issue that were reported with the release of 4.1.0.
Changelog
TypeScript Fixes
All these reported issues should now be fixed:
-
createSelector
calls with 12 or more input selectors were causing TS to fail with a "Type instantiation is excessively deep" error. After this update,createSelector
should now support up to 29 input selectors before TS has type issues. (and if you've got more than 29 input selectors.... what are you doing? :) ) - Passing multiple input selectors with mismatched argument types should have been failing to compile, but was being silently accepted (ie
(a: number) => 42, (b: string) => 123
) - The
OutputParametricSelector
type, which is re-exported by Redux Toolkit, was inadvertently left out of the list of Reselect type exports during the rewrite and caused RTK builds to fail - Input selectors that were typed to return
SomeType | undefined
were causing the entire selector to be typed as possibly returningundefined
Caching Undefined Values
The previous internal cache logic had a couple of if (foundValue !== undefined)
checks inside, but that broke cases where a selector intentionally wanted to return undefined
as the actual result.
The cache logic has been updated to use an internal sentinel value as the NOT_FOUND
result instead, allowing undefined
to be correctly cached and returned.
What's Changed
- Split out optional last argument (memoizeOptions) into it's own overload by @eXamadeus in https://github.com/reduxjs/reselect/pull/530
- increase subselector number by @phryneas in https://github.com/reduxjs/reselect/pull/528
- build intersection type instead of union type in
GetStateFromSelectors
by @phryneas in https://github.com/reduxjs/reselect/pull/529 - Update cache to support storing a value of
undefined
by @markerikson in https://github.com/reduxjs/reselect/pull/532
New Contributors
- @phryneas made their first contribution in https://github.com/reduxjs/reselect/pull/528
Full Changelog: https://github.com/reduxjs/reselect/compare/v4.1.0...v4.1.1
Configuration
-
If you want to rebase/retry this MR, click this checkbox.
This MR has been generated by Renovate Bot.