You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As you can see, I have the ID 9531 in the array but nothing comes out of the #each block.
However, if in the each block I add this text to debug
{#eachfieldValue.subfieldValuesassubfieldValue, i (subfieldValue)}
Rendering index: {i} <-- this line
It renders everything perfectly:
Now... let's complexify things:
This is a Ruby on Rails project setup with ruby-vite and using InertiaJS.
If I'm running the vite dev server bin/vite dev the issue is not present.
I receive the payload from the backend. I noticed that if I remove the state.snapshot(post) it doesn't happen. I also noticed that the bug is also present if I create a copy with a trick like JSON.parse(JSON.stringify(post))
let { post }: Props = $props(); // fieldValues are `post.fieldValues`
let data = $derived($state.snapshot(post));
{#each data.fieldValues as _fieldValue, i (data.postGroup.postType.id)}
<FieldValueForm fieldValue={data.fieldValues[i]} />
<FormButton class="w-fit">Save</FormButton>
{/each}
I have also noticed that if I change the key of the #each to something like
Before:
{#eachfieldValue.subfieldValuesassubfieldValue, i (subfieldValue)}
After:
{#eachfieldValue.subfieldValuesassubfieldValue, i (subfieldValue.id)}
the bug is also not present. However I don't have IDs until the database is saved.
The weirdest of all. In one of the branch condition, there is a component named FlexibleFieldValueForm that is rendered. Inside that components there is a loop that renders back the same previous component FieldValueForm with its "flexible" child values.
This is a private project and I was unable to extract it into a smaller reproduction project. I am still willing to colaborate as much as possible without violating the rights i'm being put under. Let me know if I can provide with anything
Describe the bug
The bug started in next.162. The bug is not present in next.160. (161 appears to no longer exist)
This most likely relates to: #11836
Ok, this is going to be very hard to explain as I couldn't understand it very well myself.
I have an
#each
block that doesn't render at all but only under very specific circonstances.This is the exact code:
Note: Component FlexibleFieldValueForm recursively re-render FieldValueForm
FieldValueForm.svelte
As you can see, I have the ID
9531
in the array but nothing comes out of the#each
block.However, if in the each block I add this text to debug
It renders everything perfectly:
Now... let's complexify things:
This is a Ruby on Rails project setup with ruby-vite and using InertiaJS.
bin/vite dev
the issue is not present.state.snapshot(post)
it doesn't happen. I also noticed that the bug is also present if I create a copy with a trick likeJSON.parse(JSON.stringify(post))
#each
to something likethe bug is also not present. However I don't have IDs until the database is saved.
FlexibleFieldValueForm
that is rendered. Inside that components there is a loop that renders back the same previous componentFieldValueForm
with its "flexible" child values.Changing that code to this will fix the issue
but changing it to a single line and forcing index 0 wont.
Reproduction
This is a private project and I was unable to extract it into a smaller reproduction project. I am still willing to colaborate as much as possible without violating the rights i'm being put under. Let me know if I can provide with anything
Logs
No response
System Info
Severity
blocking all usage of svelte
The text was updated successfully, but these errors were encountered: