Fix for incorrect compile check#3567
Fix for incorrect compile check#3567vadimka123 wants to merge 3 commits intoJedWatson:masterfrom vadimka123:fix-ensure-checks
Conversation
|
Thanks @vadimka123 but I'm not seeing the problem here. With the latest version of prettier, that code is preserved as expected, and the logic will be the same before and after your change. Are you seeing a different behaviour? |
|
@JedWatson, I've seen this behavior before |
|
@JedWatson, it's issue is not fixed |
|
@vadimka123 Sorry for the delay, I've worked out what's going on here. This isn't actually a prettier issue but a babel optimisation, and it's going to behave correctly because the Logical AND operator has a higher precedence (6) than the Logical OR operator (5) in JavaScript. Which means this code is safe to leave as-is, and the parenthesis grouping the logic are really just helping with code readability (as discussed on that prettier issue you linked) reference https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence So I'm going to close this, but I personally learned something in the process, so thank you! |

Fix check for ensure focus. Now code compiled as (isFocused && !isDisabled && prevProps.isDisabled || isFocused && menuIsOpen && !prevProps.menuIsOpen). See prettier/prettier#187