New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow controls.start()
dynamic functions to return variant names
#1323
Conversation
controls.start
dynamic functions to return variant namescontrols.start()
dynamic functions to return variant names
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 9946d69:
|
/** | ||
* If the variant definition is a function, resolve. | ||
*/ | ||
if (typeof definition === "function") { | ||
definition = definition( | ||
custom ?? props.custom, | ||
currentValues, | ||
currentVelocity | ||
) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As this is now in there twice, should we pull it into a resolve
function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did think about reducing duplication but if anything we'd probably just be padding out the file given that the only real duplication is the typeof check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, right, that makes sense.
Well, if you name the function right you wouldn't need the comment and there's the ??
but I see your point.
ef0b0f0
to
9946d69
Compare
Fixes #503