-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Signals inside array/objects doesnt serialize correctly #7864
Comments
Thanks for opening an issue! I think we might be serializing these correctly, but the Preact integration isn't rehydrating the signals properly. If you want to dig into this and open a PR, we'd be happy to take a look! The serialization logic for Preact should be mostly in the signals.ts file. |
Looking at signals.ts as @natemoo-re suggested, we skip serializing signals nested in arrays (and objects) entirely because If we wanted to support arbitrary-depth nesting of signals, calling |
@natemoo-re any news on props serialization? I can see that #8004 has been closed. I was wondering if someone is working on it, so that we can have components which use large data without the props bloating the html |
What version of
astro
are you using?2.9.6
Are you using an SSR adapter? If so, which one?
None
What package manager are you using?
npm
What operating system are you using?
Linux
What browser are you using?
Firefox 115.0.3
Describe the Bug
Hi, im new to this Astro-(p)react world, so i dont know if im doing things the right way, but i think i found bug when using signals whitin arrays/objects.
Tweaking the example to pass an array of signals as a prop, doesnt render anything and actions doesnt work either.
Here i have used
value
because it gave an error about cyclic dependenciesAt first i thought the error was here as it only checks for shallow signals, but i havent investigated any further nor deep enough.
astro/packages/integrations/preact/src/signals.ts
Line 32 in d2b6dab
What's the expected result?
Signals should be serialized independant whether they are inside an array/object or not.
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-488db8?file=src%2Fpages%2Findex.astro
Participation
The text was updated successfully, but these errors were encountered: