Run input selectors twice, to check stability.#612
Conversation
|
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. Latest deployment of this branch, based on commit afc8bd3:
|
markerikson
left a comment
There was a problem hiding this comment.
Looks good overall. Can you make these couple tweaks?
| ) | ||
|
|
||
| // @ts-ignore | ||
| const makeAnObject: (...args: unknown[]) => object = memoize( |
There was a problem hiding this comment.
✋ Should this be moved inside the NODE_ENV check?
There was a problem hiding this comment.
it could, but i think that would be worse for performance? this creates one function when the selector is created, moving it inside would make a new function every time the check runs
| makeAnObject.apply(null, params) === | ||
| makeAnObject.apply(null, paramsCopy) | ||
| if (!equal) { | ||
| // do we want to log more information about the selector? |
There was a problem hiding this comment.
💬 What happens if we reference selector.name here? Does it end up as "selector", or whatever we assigned it to?
Scratch that, it comes back as "memoized", because defaultMemoize.ts has function memoized().
Mmm... We could at least log out the original inputs and both sets of extracted values?
There was a problem hiding this comment.
added
{
arguments,
firstInputs: params,
secondInputs: paramsCopy
}open to better names 🙂
fixes #611