fix(deps): update dependency reselect to v5#775
Closed
renovate[bot] wants to merge 1 commit intomasterfrom
Closed
Conversation
9372c37 to
b47b564
Compare
b47b564 to
104afd4
Compare
104afd4 to
8ddfac4
Compare
Member
|
Part of a larger migration that requires a more deliberate approach than using renovate PRs: Closing |
Contributor
Author
Renovate Ignore NotificationBecause you closed this PR without merging, Renovate will ignore this update. You will not get PRs for any future If you accidentally closed this PR, or if you changed your mind: rename this PR to get a fresh replacement PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
^4.0.0→^5.0.0Release Notes
reduxjs/reselect (reselect)
v5.1.1Compare Source
This patch release fixes behavior of
resultEqualityCheckinweakMapMemoize, fixes the case oflruMemoizebeing given amaxSizeless than 1, and tweaks the internal implementation oflruMemoize. (We've also updated our general build tooling.)Changelog
Bug fixes
Previously, providing the
resultEqualityCheckoption toweakMapMemoizeresulted in it being called with empty objects as part of the initialization / dev check process. That could be an issue if your comparison function expected different values. We've updated the logic to avoid that, as well as improving a couple other perf aspects.Previously, passing a
maxSize< 1 tolruMemoizewould result in it creating a larger cache. That's now fixed.lruMemoizenow uses a symbol for itsNOT_FOUNDvalue instead of a string.What's Changed
lruMemoizecorrectly memoizes whenmaxSizeis set to a number less than 1 by @aryaemami59 in #698resultEqualityCheckbehavior inweakMapMemoizeby @aryaemami59 in #699Full Changelog: reduxjs/reselect@v5.1.0...v5.1.1
v5.1.0Compare Source
This minor release:
createSelector.withTypes<RootState>()andcreateStructuredSelector.withTypes<RootState>()APITypedStructuredSelectorCreatortype introduced in 5.0identityFunctionCheckby only running if the output selector is passed one argumentweakMapMemoize'sresultEqualityCheckwhen used with a primitive result.withTypesMost commonly, selectors will accept the root state of a Redux store as their first argument.
withTypesallows you to specify what that first argument will be ahead of creating the selector, meaning it doesn't have to be specified.Known limitations
Due to a Typescript issue, inference of the output selector's parameters only works with
withTypeswhen using an array of input selectors.If using the variadic version, you can either wrap your input selectors in an array instance (as above), or annotate the parameters manually.
What's Changed
identityFunctionCheckfalse positives by @Methuselah96 in #660_lastResult.derefis not a function (it is undefined) in React Native and Expo applications by @aryaemami59 in #671createSelectorviacreateSelector.withTypes<RootState>()method by @aryaemami59 in #673TypedStructuredSelectorCreatorby @aryaemami59 in #667createStructuredSelectorviacreateStructuredSelector.ts.withTypes<RootState>()method by @aryaemami59 in #678vitestto v1 by @aryaemami59 in #668New Contributors
Full Changelog: reduxjs/reselect@v5.0.1...v5.1.0
v5.0.1: v5.0.0Compare Source
This major release:
createSelectorto use a newweakMapMemoizemethod as the default memoizerdefaultMemoizemethod tolruMemoizecreateSelectorThis release has breaking changes. (note: this points to v5.0.1, which contains a hotfix that was released prior to the announcement.)
This release is part of a wave of major versions of all the Redux packages: Redux Toolkit 2.0, Redux core 5.0, React-Redux 9.0, Reselect 5.0, and Redux Thunk 3.0.
For full details on all of the breaking changes and other significant changes to all of those packages, see the "Migrating to RTK 2.0 and Redux 5.0" migration guide in the Redux docs.
We have a new docs site! The Reselect docs are now at https://reselect.js.org.
Changelog
createSelectorUsesweakMapMemoizeBy DefaultReselect's
createSelectororiginally only had one memoization function, which has originally calleddefaultMemoize(and per below, is now renamed tolruMemoize). It's always used a customizable comparison method to compare each argument. Over time, we added more functionality, particularly in v4.1.0 wherelruMemoizegained options for{memoize, maxSize, resultEqualityCheck}.However,
lruMemoizehas limitations. The biggest one is that the default cache size is 1. This makes selector instances hard to reuse in scenarios like list items, which might callselectSomeValue(state, props.id), and thus never actually memoize due to changing arguments. There are workarounds, but they're cumbersome - usingcreateSelectorCreatorto create a customizedcreateSelectorfunction with a different memoization implementation, creating unique selector instances per component, or setting a fixedmaxSize.For 5.0, we added a new
weakMapMemoizememoization function, which takes a different approach (as originally implemented in the React codebase). It uses an internal tree of cache nodes rather than a single value or a list of values. This givesweakMapMemoizean effectively infinite cache size!We've done a fair amount of testing, and
weakMapMemoizeboth performs faster and has more frequent cache hits thanlruMemoize.Given that, we've made the switch so that
createSelectorusesweakMapMemoizeby default! This should result in better performance for Redux and React apps that use Reselect.This is hopefully a mostly non-breaking change at the code level, and an overall improvement at the behavior level.
This is a breaking change.
weakMapMemoizedoes not have anequalityCheckoption or allow customizing the comparison behavior - it's entirely based on reference comparisons, since it usesWeakMap/Mapinternally. It also does not have amaxSizeoption, but does haveresultEqualityCheck.If you need to customize the overall equality comparison behavior, import and pass
lruMemoizeas thememoizeandargsMemoizeoption!Also, note that an "infinite cache size" from one point of view can be considered a "memory leak" for another point of view. The use of
WeakMaps should mean that in most cases values do get garbage collected when the rest of the app no longer needs those, but there may be some scenarios with use of primitive keys that could lead to potential leaks. If this looks like it's happening for you, please compare behavior withlruMemoizeinstead, and file an issue report so we can investigate.New / Improved
createSelectorMemoization OptionsOriginally, the only way to customize
createSelector's behavior (such as using an alternate memoization function) was to first create a customized version viacreateSelectorCreator(memoizerFunction, memoizerOptions). This was typically used for creating use cases like deep equality comparisons with_.equalinstead of shallow equality, as well as alternate memoizers that had a notion of cache size.With Reselect 4.1.0, we added the ability to pass memoizer options directly to
createSelector, and also updateddefaultMemoizeto accept several options such as a max cache size. This meant that you could callcreateSelector(...inputFns, outputFn, {memoizeOptions: {maxSize: 100}}), but you couldn't change the memoizer _function_ being used directly - that still required use ofcreateSelectorCreator`.Additionally, Reselect internally uses the provided memoizer function twice internally: once on the overall arguments passed to
selectSomeValue(a, b, c), and a second time on the values extracted by the input functions such asstate => state.a. There have been multiple issues over the years where users wanted to provide separate memoization functions for the arguments vs the extracted values, such as a reference equality check for the arguments and a shallow check for the extracted values.With this release, you can now pass alternate memoizer functions directly to
createSelector, and bothcreateSelectorandcreateSelectorCreatoraccept separate options formemoizeandargsMemoize(along with any options for those):This should mostly eliminate the need to use
createSelectorCreatorfor customization. (You can still use it for encapsulation / reuse if you want to create many selectors with the same customization options.)ESM/CJS Package Compatibility
The biggest theme of the Redux v5 and RTK 2.0 releases is trying to get "true" ESM package publishing compatibility in place, while still supporting CJS in the published package.
The primary build artifact is now an ESM file,
dist/reselect.mjs. Most build tools should pick this up. There's also a CJS artifact, and a second copy of the ESM file namedreselect.legacy-esm.jsto support Webpack 4 (which does not recognize theexportsfield inpackage.json). Additionally, all of the build artifacts now live under./dist/in the published package.Modernized Build Output
We now publish modern JS syntax targeting ES2020, including optional chaining, object spread, and other modern syntax. If you need to
Build Tooling
We're now building the package using https://github.com/egoist/tsup. We also now include sourcemaps for the ESM and CJS artifacts.
Dropping UMD Builds
Redux has always shipped with UMD build artifacts. These are primarily meant for direct import as script tags, such as in a CodePen or a no-bundler build environment.
We've dropped those build artifacts from the published package, on the grounds that the use cases seem pretty rare today.
There's now a
reselect.browser.mjsfile in the package that can be loaded from a CDN like Unpkg.If you have strong use cases for us continuing to include UMD build artifacts, please let us know!
Dev Mode Checks
createSelectornow does checks in development mode for common mistakes, like input selectors that always return new references, or result functions that immediately return their argument. These checks can be customized at selector creation or globally.This is important, as an input selector returning a materially different result with the same parameters means that the output selector will never memoize correctly and be run unnecessarily, thus (potentially) creating a new result and causing rerenders.
This is done the first time the selector is called, unless configured otherwise. See the Reselect docs on dev-mode checks for more details.
TypeScript Changes
We've dropped support for TS 4.6 and earlier, and our support matrix is now TS 4.7+.
The
ParametricSelectorandOutputParametricSelectortypes have been removed. UseSelectorandOutputSelectorinstead.The TS types have been updated to provide a better visual hover preview representation of a selector. It should now actually be previewed as "a function with attached fields", like:
Other Changes
Selectors now have a
dependencyRecomputionsmethod that returns how many times the dependency memoizer recalculated, and aresetDependencyRecomputationsmethod that resets that value.Similarly, both
weakMapMemoizeandlruMemoizenow haveresultsCountandresetResultsCountmethods that count how many times they actually calculated new values. This should be equal to the number of outer recomputations, unless you have passed inresultEqualityCheckas an option, in which case it only counts times a new actual reference was returned.Huge thanks to @aryaemami59 for some incredibly comprehensive efforts reworking the internals of
createSelector, our TS types, and the codebase structure in order to make all these changes possible!What's Changed
createSelector. by @aryaemami59 in #626unstable_autotrackMemoizeand bump Vitest version by @markerikson in #631resetRecomputationsandresetDependencyRecomputationsbehavior to their types by @aryaemami59 in #646resultEqualityChecktoweakMapMemoizeby @markerikson in #647EqualityFnslightly more type-safe. by @aryaemami59 in #651x => x. by @aryaemami59 in #645defaultMemoizetolruMemoizeby @aryaemami59 in #654Full Changelog: reduxjs/reselect@v4.1.8...v5.0.1
v5.0.0Compare Source
Configuration
📅 Schedule: Branch creation - Between 12:00 AM and 03:59 AM, only on Monday ( * 0-3 * * 1 ) in timezone America/New_York, Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.