-
Notifications
You must be signed in to change notification settings - Fork 65
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
Minifier-friendly references to properties #183
Minifier-friendly references to properties #183
Conversation
0c7765d
to
2e710dc
Compare
Thanks for the PR @sd-yip ! Please come and talk about it on the PureScript Discord contrib channel. https://discord.com/channels/864614189094928394/938253816862736405 |
src/React.js
Outdated
throw new Error("[purescript-react] Not a component property: " + prop); | ||
function curry2(f) { | ||
return f === undefined ? f : function (a, b) { | ||
return f(a)(b) |
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 don't think these are correct. They are missing the ()
for invoking the effects (ie, it's not just a curry).
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 see. Previously, I applied the amount of arguments + 1 as the currying number for UNSAFE_componentWillReceiveProps
and UNSAFE_componentWillUpdate
, but not sure why I have missed them for the remaining.
Now the invocation and currying should be fixed. Please take another look.
Description of the change
Dynamically matching property names in a switch is hard to detect and optimize. Currently, it breaks minifier outputs under aggressive minification settings. This PR modifies the corresponding part for easier usage with a minifier.
Checklist: