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 customizedmemoizeandargsMemoizefunctions, alongside their respective options (memoizeOptionsandargsMemoizeOptions). - The
createSelectorfunction now supports direct customization ofmemoizeandargsMemoizewithin its options object.
Memoization Functions
- Introduced new experimental memoization functions:
weakMapMemoizeandunstable_autotrackMemoize. - Incorporated
memoizeandargsMemoizeinto 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 infiniteerror.
Selector API Enhancements
- Removed the second overload of
createStructuredSelectordue to its susceptibility to runtime errors.
Additional Functionalities
- Added
dependencyRecomputationsandresetDependencyRecomputationsto the Output Selector Fields. These additions provide greater control and insight over input selectors, complementing the newargsMemoizeAPI. - 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
createSelectortoweakMapMemoize. - Renamed
defaultMemoizetolruMemoizeas it is no longer the default memoization function passed tocreateSelector. - Renamed
defaultEqualityChecktoreferenceEqualityCheck. - Renamed
DefaultMemoizeOptionstoLruMemoizeOptions. - Removed
ParametricSelectorandOutputParametricSelectortypes. Their functionalities are now integrated intoSelectorandOutputSelectorrespectively, which inherently support additional parameters.