Replies: 1 comment
-
ok so the reason this optimization exists is to handle the following { posts() && <Posts/>} this is equivalent to using <Show when={posts()}><Posts/></Show> The intention is to show the posts if we have any posts casting to Boolean and memoizing solve for not re-rendering on any truthy value change. In so instead we need to revert to <Show when={count()} keyed>
{Date.now()}
</Show> or even <>{()=>count() && Date.now()}</> which is not recommended and might raise a warning in the types. https://playground.solidjs.com/anonymous/d926ace1-75ba-4cc3-945f-bcf5e6578cdb There is no equivalent to the { /*@!memo*/ count() && Date.now() } like we have the thanks @ryansolid for the feedback in the discord |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
https://playground.solidjs.com/anonymous/bfbaa513-3926-4e33-a20e-eb4335544957
compiles to
any thoughts, I understand this is some sort of optimization
to memo the condition, but what is the reason that it also explicitly cast to boolean?
this breaks expectations from the evaluation of binary logical operators
and to escape this we need something like this
https://playground.solidjs.com/anonymous/54871ab2-874e-4b70-8c5c-2504e30718f9
Beta Was this translation helpful? Give feedback.
All reactions