Closed aryaemami59 closed 8 months ago
Name | Link |
---|---|
Latest commit | cc884ccdc70eb04faa401b5baa5abf6bb5cb117b |
Latest deploy log | https://app.netlify.com/sites/reselect-docs/deploys/65d620ac0efa7c0008b51fa0 |
This pull request is automatically built and testable in CodeSandbox.
To see build info of the built libraries, click here or the icon next to each commit SHA.
Thanks for working on this! I believe this PR is related to this issue: https://github.com/reduxjs/reselect/issues/693
related, but not a complete fix - if inputs aren't stable, your resultEqualityCheck will still be called with an empty object
nonetheless the improvements here are nice
@keegan-lillo This should mitigate the problem as long as your input selectors are stable. It will at least make the default configs a tiny bit less problematic. But @EskiMojo14 is correct, it doesn't fully address the issue.
this looks good, but has conflicts - happy to merge once fixed
thanks!
Hey @EskiMojo14, any chance a release could be cut which contains this change?
Sorry for the delay on this. I should have time to get it out on Saturday.
Okay, out in https://github.com/reduxjs/reselect/releases/tag/v5.1.1 !
Overview
Previously using
weakMapMemoize
withresultEqualityCheck
would cause theresultEqualityCheck
to be called with empty objects as arguments due to howinputStabilityCheck
works. Here's a summary of the changes:This PR:
resultEqualityCheck
inweakMapMemoize
so that when input selectors are stable,resultEqualityCheck
does not get called on the first run of the output selector.resultEqualityCheck
works correctly when set toshallowEqual
.resultEqualityCheck
is not called on the first output selector call.weakMapMemoize
/lruMemoize
withresultEqualityCheck
set toreferenceEqualityCheck
works the same asweakMapMemoize
/lruMemoize
withoutresultEqualityCheck
.resultEqualityCheck
performance impact.inputStabilityCheck
andresultEqualityCheck
.weakMapMemoize
where settingresultEqualityCheck
toreferenceEqualityCheck
would preventmemoizedResultFunc.resultsCount()
from incrementing upon result recalculation.weakMapMemoize
when comparing two memoized functions, one withresultEqualityCheck
set toreferenceEqualityCheck
and the other withoutresultEqualityCheck
. Previously, there was a noticeable discrepancy between the two, which has now been corrected to achieve the desired effect.