Skip to main content

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 customized memoize and argsMemoize functions, alongside their respective options (memoizeOptions and argsMemoizeOptions).
  • The createSelector function now supports direct customization of memoize and argsMemoize within its options object.

Memoization Functions

  • Introduced new experimental memoization functions: weakMapMemoize and unstable_autotrackMemoize.
  • Incorporated memoize and argsMemoize 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

Additional Functionalities

  • Added dependencyRecomputations and resetDependencyRecomputations to the Output Selector Fields. These additions provide greater control and insight over input selectors, complementing the new argsMemoize 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 to weakMapMemoize.
  • Renamed defaultMemoize to lruMemoize as it is no longer the default memoization function passed to createSelector.
  • Renamed defaultEqualityCheck to referenceEqualityCheck.
  • Renamed DefaultMemoizeOptions to LruMemoizeOptions.
  • Removed ParametricSelector and OutputParametricSelector types. Their functionalities are now integrated into Selector and OutputSelector respectively, which inherently support additional parameters.