Skip to content

Conversation

@EskiMojo14
Copy link
Contributor

@EskiMojo14 EskiMojo14 commented May 13, 2023

fixes #611

@codesandbox-ci
Copy link

codesandbox-ci bot commented May 13, 2023

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:

Sandbox Source
Vanilla Configuration
Vanilla Typescript Configuration

@EskiMojo14 EskiMojo14 changed the title Begin investigating running input selectors twice, to check stability. Run input selectors twice, to check stability. May 14, 2023
Copy link
Contributor

@markerikson markerikson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall. Can you make these couple tweaks?

)

// @ts-ignore
const makeAnObject: (...args: unknown[]) => object = memoize(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✋ Should this be moved inside the NODE_ENV check?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💬 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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

{
  arguments,
  firstInputs: params,
  secondInputs: paramsCopy
}

open to better names 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Run selectors twice in development to warn for memoization failures

3 participants