-
Notifications
You must be signed in to change notification settings - Fork 672
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
weakMapMemoize
with resultEqualityCheck
is provided empty objects for first call.
#693
Comments
hmm, this is a good point - I'm not sure of the best fix for this, but I agree it's not great. |
Really excited about I could be missing something @EskiMojo14, but this is the code I would have expected for const { inputSelectorResults, inputSelectorResultsCopy } =
inputSelectorResultsObject
const areInputSelectorResultsEqual =
(memoizeOptions?.equalityCheck ?? shallowEqual)(inputSelectorResults, inputSelectorResultsCopy) I don't think If this ^ doesn't work, maybe the best option is just omitting |
we need to treat memoizeOptions as an opaque value, because it could be anything depending on what memoizer is being used. For example, weakMapMemoize's options don't have an The only way (I can think of) that we can accurately assess that the memoizer, when configured the same way as it is for the output selector, considers the inputs to be different is to do what we do - memoize a separate function that always returns a new reference, with the exact same options used when memoizing the output selector. |
Hi! Thanks for all the great QOL improvements in Reselect 5, however I've found a pretty major issue with the
resultEqualityCheck
option when using theweakMapMemoize
memoization. It calls theresultEqualityCheck
even if it is the first time the selector has run. This wouldn't be too bad, however this first call is called with empty objects instead of the actual result of the selector. Please see the example below. Obviously this is a bit of a contrived example using strings, but things get pretty hairy if you expect the result to be aSet
or another complex object.Expected Console Output:
Actual Console Output:
The text was updated successfully, but these errors were encountered: