I think I found a bug in compose. This should disp...
# compose
r
I think I found a bug in compose. This should display the text "blah" if I'm not mistaken.
Changing the return type of the inline lambda from Unit to Int gets the correct result.
a
I think we might be tracking this one already but please do file it just in case; we can mark as duplicate if needed. Try this as an alternative:
Copy code
Text(x ?: "blah")
generally you should prefer this form when possible as it retains the identity of the
Text
as being the same when recomposing one branch vs. the other
r
I'm not actually doing this in my code, it's just a simplified case.
👍 1
a
a plain if/else should also behave as expected
r
Thanks. I know how to work around this.
I just post bugs in here to see if anyone else has seen it before and if it's being tracked.
Here is my actual use.
a
while I fully agree that this is a bug, that code would be far easier to read as an if/else 🙂
r
readability is in the eye of the beholder 🙂
Also because selectedItem is accessed using a delegate method, smartcasting doesn't work. So I need to pin the value using a
val
or
when
or
let
etc...