question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

memoize: specify equality check

See original GitHub issue

I would like to be able to specify the equality check of my memoize instead of serialising the arguments and check their values equality, for an Object or an Array I want to be able to do a reference equality check.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
CrossEyecommented, Mar 4, 2017

@Bradcomp:

That works. If someone wants to push for this I wouldn’t fight it. But…

I find I care very little about memoize. I’ll probably be kicking myself the next time my CRUD service is in desperate need of fast access to the Fibonacci numbers, but there you have it.

1reaction
Bradcompcommented, Mar 4, 2017

@CrossEye I think I’ve used it exactly once in production code, so I’m right there with you, although I might get double or even triple the usage out of it if serialization was more efficient 😜

memoizeBy seems like a much easier solution than allowing for arbitrary equality comparisons, which would require a whole different approach as @davidchambers mentioned.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Reselect's Memoization in 3 Functions | HackerNoon.com |
so the first function in Reselect is a simple equality check which is used to determine the equality of arguments passed into the...
Read more >
How to create a custom equality function with reselect and ...
A standard reselect selector invalidates its memoized value and recomputes it if the input selectors fail a strict equality check:
Read more >
Improving React application performance: React.memo vs ...
memo can use our custom equality check function to determine if the props for the BarGraph component have changed and if it should...
Read more >
How To Use Memoization To Drastically Increase React ...
This referential equality is really useful when comparing objects in dependency arrays, but if you need to use a function in a dependency...
Read more >
When should you memoize in React - Prateek Surana
And since typeof children === 'object , the equality check in memo always returns false, so whenever the parent re-renders, it will cause ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found