Skip to content

Conversation

@codinsonn
Copy link

No description provided.

Comment on lines -44 to +49
if (typeof message === 'function') {
finalMessage = message(value, values, options)
}
if (typeof message !== 'undefined') {
finalMessage = message
}
if (typeof message === 'function') {
finalMessage = message(value, values, options)
}
Copy link
Author

Choose a reason for hiding this comment

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

We need to check for the function type after checking for undefined, because otherwise, if it is a function:

  1. We'll compute the message first (good)
  2. We'll then also immediately overwrite that computed message with the message function (bad)

By reversing the order, we avoid this

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.

1 participant