Back to Reselect

What's New in 5.0.0?

website/docs/introduction/v5-summary.mdx

5.1.12.8 KB
Original Source

import { ExternalLinks } from '@site/src/components/ExternalLinks' import { InternalLinks } from '@site/src/components/InternalLinks'

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 <InternalLinks.CreateSelectorCreator />, allowing for customized memoize and argsMemoize functions, alongside their respective options (memoizeOptions and argsMemoizeOptions).
  • The <InternalLinks.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 <InternalLinks.OutputSelectorFields /> 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 <InternalLinks.OutputSelector text="output selectors" />. The nesting limit has increased from approximately 8 to around 30 <InternalLinks.OutputSelector text="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 <InternalLinks.CreateStructuredSelector /> due to its susceptibility to runtime errors.

Additional Functionalities

  • Added dependencyRecomputations and resetDependencyRecomputations to the <InternalLinks.OutputSelectorFields />. These additions provide greater control and insight over <InternalLinks.InputSelectors />, complementing the new argsMemoize API.
  • Introduced inputStabilityCheck, a development tool that runs the <InternalLinks.InputSelectors /> 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 <InternalLinks.ResultFunction /> is an <ExternalLinks.IdentityFunction /> .

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.