What's New in 5.0.0?
Version 5.0.0 introduces several new features and improvements:
Customization Enhancements
- Added the ability to pass an options object to
createSelectorCreator
, allowing for customizedmemoize
andargsMemoize
functions, alongside their respective options (memoizeOptions
andargsMemoizeOptions
). - The
createSelector
function now supports direct customization ofmemoize
andargsMemoize
within its options object.
Memoization Functions
- Introduced new experimental memoization functions:
weakMapMemoize
andunstable_autotrackMemoize
. - Incorporated
memoize
andargsMemoize
into the Output Selector Fields for debugging purposes.
TypeScript Support and Performance
- Discontinued support for TypeScript versions below 4.7, aligning with modern TypeScript features.
- Significantly improved TypeScript performance for nesting output selectors. The nesting limit has increased from approximately 8 to around 30 output selectors, greatly reducing the occurrence of the infamous
Type instantiation is excessively deep and possibly infinite
error.
Selector API Enhancements
- Removed the second overload of
createStructuredSelector
due to its susceptibility to runtime errors.
Additional Functionalities
- Added
dependencyRecomputations
andresetDependencyRecomputations
to the Output Selector Fields. These additions provide greater control and insight over input selectors, complementing the newargsMemoize
API. - Introduced
inputStabilityCheck
, a development tool that runs the input selectors twice using the same arguments and triggers a warning If they return differing results for the same call. - Introduced
identityFunctionCheck
, a development tool that checks to see if the result function is an Identity Function .
These updates aim to enhance flexibility, performance, and developer experience. For detailed usage and examples, refer to the updated documentation sections for each feature.
Breaking Changes
- Switched the default memoization function used by
createSelector
toweakMapMemoize
. - Renamed
defaultMemoize
tolruMemoize
as it is no longer the default memoization function passed tocreateSelector
. - Renamed
defaultEqualityCheck
toreferenceEqualityCheck
. - Renamed
DefaultMemoizeOptions
toLruMemoizeOptions
. - Removed
ParametricSelector
andOutputParametricSelector
types. Their functionalities are now integrated intoSelector
andOutputSelector
respectively, which inherently support additional parameters.