-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
SVELTE 5 DEPLOYMENT BUG w/ #each
block, over $state
array, using bind:
#10437
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
Comments
#10422 recently fixed a few bugs around bindings with non-keyed arrays, seems like there's still something missing. The fact that it only happens in production hints to me that there might be some compiler or runtime logic that is only applied at dev time that causes this. |
Just realized that this is a reassignment, which is forbidden in runes mode (#10428 added a validation error, but seems we missed it for bindings) - your workaround with using an index is the correct approach. |
Describe the bug
This is bug is quite the ping-pong ... Everything works perfectly when built locally (
pnpm build && pnpm preview
), but breaks on deployment (Cloudflare Pages) under certain circumstances with Svelte 5.In a purely svelte 4 project — i.e. using a writable array instead of a $state array — there is no issue on deployment to the same platform.
The following works when built locally, but breaks on deployment:
where iframeModals is a $state array defined in a the
context="module"
script section of some nested component. The following fixes the deployment bug:The following non-indexed, svelte 4 variant works on deployment as well (separate, purely svelte 4 project):
where
frameModals
is now awritable
array.Summary so far:
bind:
on deployment, and with pnpm dev/build.bind:
is required to work, but breaks on deploymentbind:
doesnt work with pnpm dev ... but works with pnpm build and deployment!If I manually write out the
<iframeModal/>
component directly (no longer need thebind:
):then it works again with Svelte 5 deployment.
Reproduction
No reproduction since it's a Svelte 5 bug that appears upon deployment ... Here's the Cloudflare log:
Logs
No response
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: