Repository navigation
sidebar()'s input value should encode the open (not closed) state - #603
Conversation
| const closed = sb?.isClosed; | ||
| return closed === undefined ? false : !closed; |
There was a problem hiding this comment.
@cpsievert Is this a style choice or a technical choice? In other words, is there a reason for this approach rather than fixing the negation, e.g.
return sb ? !sb.isClosed : false;If it's stylistic, I'd agree I'm not that into using a ternary here, but I would have preferred
if (!sb) return false;
return !sb.isClosed;There was a problem hiding this comment.
IIRC, return sb ? !sb.isClosed : false; doesn't actually return what you'd expect (the !sb.isClosed doesn't negate properly)
If this actually works, I won't be opposed to it:
if (!sb) return false;
return !sb.isClosed;There was a problem hiding this comment.
I'm pretty sure the ternary does what we'd expect; at least it works as expected with the reprex and if I extract the code idea into a JS reprex: https://codepen.io/gadenbuie/pen/dyQyXyP (expand the console to see the log messages).
Closes #600