๐ BUG: Ternary expressions in slot erase everything else
tamaracha opened this issue ยท 2 comments
What version of @astrojs/compiler
are you using?
2.5.2
What package manager are you using?
npm
What operating system are you using?
Mac OS Ventura 13.6.1
Describe the Bug
If a slot, e.g., a layout's default slot, contains multiple elements and if one of them is a jsx ternary expression, only this one remains and the other ones disappear. It looks similar to #950, but with ternary instead of loops.
Everything before and after this within a slot will be erased:
{isLeaf ? <p>Leaf</p> : <p>Branch</p>}
Moving the expression into a fragment solves the problem:
<>
{isLeaf ? <p>Leaf</p> : <p>Branch</p>}
</>
Is this intended?
My reprex is the astro blog template with the critical addition in the BlogPost layout.
Link to Minimal Reproducible Example
Thanks for reporting the issue! This seems like regression that snuck in with the last patch. I'll dig into this further to get a fix ASAP.
A similar issue is happening with fragments. It might be related to this. Link to issue: withastro/astro#9997