Git Product home page Git Product logo

Comments (3)

EskiMojo14 avatar EskiMojo14 commented on June 2, 2024

hmm, this is a good point - the resultEqualityCheck is typed to only expect the result of the memoized function (edit: it's actually typed as any), but the inputStabilityCheck uses the same memoizeOptions and memoize with a different function, one that always returns a new empty object. This is important for how the check works.

I'm not sure of the best fix for this, but I agree it's not great.

from reselect.

braeden avatar braeden commented on June 2, 2024

Really excited about reselect v5 but +1 on this being upgrade blocking 😞 . We almost guarantee a (development-only) runtime break when resultEqualityCheck does any sort of complex work. (and disabling inputStabilityCheck feels like a band-aid fix)


I could be missing something @EskiMojo14, but this is the code I would have expected for inputStabilityCheck:

const { inputSelectorResults, inputSelectorResultsCopy } =
    inputSelectorResultsObject
const areInputSelectorResultsEqual =
   (memoizeOptions?.equalityCheck ?? shallowEqual)(inputSelectorResults, inputSelectorResultsCopy)

I don't think resultEqualityCheck or maxSize should matter/not sure why we need to setup the full memoize again?


If this ^ doesn't work, maybe the best option is just omitting resultEqualityCheck from the ...memoizeOptions spread.

from reselect.

EskiMojo14 avatar EskiMojo14 commented on June 2, 2024

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 equalityCheck property.

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.

from reselect.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.