solid-start: does not support reactive values?
<Title>
{appState.title
? `${appState.title} - RedditLattice`
: `RedditLattice`}
</Title>
This in my root.tsx doesn’t work and I have confirmed with a console log in a createEffect that appState.title does trigger a signal to change.
Relevant Source Code: https://github.com/vanillacode314/redditlattice/blob/solidjs/src/root.tsx
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 15 (2 by maintainers)
fixed upstream in @solidjs/meta
Yeah you are probably right about the bug… and you are right about your assumption about the JSX. Ternaries are reactive. And
Show
basically is slightly more optimal where it will avoid recreating dom elements if it doesn thave to.Edit: after looking into this a bit closer, it seems like I had a bug in my own code, and the first behavior I described doesn’t really happen. It’s working fine. The other bug (empty tag) does still happen under some circumstances.
Hi, ~I’ve also run into this bug,
<Title />
just doesn’t behave as other head tags would (e.g.Meta
, where the lowest tag “wins” and replaces any previous ones), which is unexpected~, plus I’ve also run into empty<title>
on client-side navigation as @gcavanunez shared.Also, I’m fairly new to Solid so I might be confused, but my understanding is that anything inside of a JSX expression is reactive, as JSX expressions get essentially compiled to “smart”
createEffect
-like calls, so a ternary (or absolutely any JavaScript expression that correctly uses signal or store accessors) should work, without the need forShow
, although it’s also my understanding thatShow
has some advantages that I don’t remember right now over certain plain JS conditional expressions, iirc.In conclusion, there’s definitely something broken with
Title
in need of a bug fix, I’ve confirmed this in my blog 😛