// the find
dai-shi/proxy-memoize
Intuitive magical memoization library with Proxy and WeakMap
proxy-memoize wraps the input object in Proxies, records which property paths the function actually read, and re-runs the function only when one of those paths changes between calls. It suits React and Redux developers who want selector memoization without listing input selectors by hand, or without writing a resultEqualityCheck to stop needless re-renders.
Dependency tracking works at property-access granularity, so the README's todo example holds: a selector that maps todos to their text does not recompute when a todo's completed flag changes, which reselect cannot do without extra equality logic. The two-tier cache is a sensible split. The WeakMap tier answers repeat calls with the same object reference for free, and the size-1 proxy tier covers new references that touch the same paths. The core is small and builds on proxy-compare, and the tests directory has regression files named after specific issue numbers, which suggests reported bugs get pinned down.
Correctness depends entirely on the input being immutable, and nothing enforces it. Mutate the state object and the memoized function returns stale results with no warning, and the README concedes there is no workaround. Returning Set or Map values is unsafe because proxies leak into them and touching their contents records spurious paths, again with no fix. The project status section warns of possible bugs with nested memoized selectors, and the README itself says nesting is slower, so composing selectors is where you should test hardest. Only one argument is supported. memoizeWithArgs lifts that limit but turns off the WeakMap tier, and the docs are thin by the README's own admission.