Closed sransara closed 3 months ago
Hey. What is the use case for the feature? Signals are more about client side reactivity
I want to server side render a prose component, such that the inner tags can define and refer to each other and render by their occurrence number in the prose component.
For example:
<Prose>
....
<Figure name="hello" />
....
Refer to <Ref name="hello" />
....
</Prose>
Renders:
<article>
<figure><a id="hello"><img src=... /><caption>Image 1. hello</caption>
Refer to <a ref="#id">Image 1. hello</a>
</article>
Above works alright, until I have a forward reference where the Figure tag comes after Ref tag. Hence needing some sort of re-render. I was hoping to use signals to prevent the need to re-render the whole tree and just surgically update the subscribed components.
I was thinking, when preact-render-to-string
's render
is called, it will wait until subscribed components are updated and then render the final result.
Signals are more about client side reactivity
Considering that, what I'm trying seems out of scope. Thank you. I'll close this ticket.
As I see preact render to string even do not run effects. So probably it's one way renderer https://stackblitz.com/edit/preact-starter-template-tbszme?file=Components.tsx
Right. Thanks for checking. I was just reading this article: https://codewithhugo.com/react-useeffect-ssr/ and the reasoning makes sense.
Environment
@preact/signals-core
@preact/signals
Describe the bug Are signals not supposed to reactive when used with
preact-render-to-string
'srender
? Am I doing something wrong or is there a bug?To Reproduce
https://stackblitz.com/edit/preact-starter-template-t9utmr?file=Components.tsx
I have a signal and two components that share it. Rendered with preact-render-to-string. The expected run time environment is the server with no hydration.
Expected behavior
I was expecting that when
zxcv
Image is added,zxcv
Ref will react to it and update the value to 4.Thank you.