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
Some elements needs to be re-created (and not just updated) when some defined context changes. For example, I have a widget where I can select different parts of an object, and I have next to it properties that applies to the selected object part. I need to recreate the input widgets when the selected part changes else they keep the context they are in and don't refresh properly.
<script>
$: context={unique_context_key: blah_blah_}</script>
{#each [context] as context (unique_context_key)}
... html code that is re-created when the unique key changes ...
{/each}
Describe the solution you'd like
A specific svelte syntax to avoid the clumsy {#each}
It could be a specific hash directive, or a specific parameter like svelte:key=.
Describe alternatives you've considered
The workaround described above
How important is this feature to you?
Once I found the workaround, it's really enough. It's just clumsy and you want to find something better for code style.
Here, when I change the selected box on the left, the properties on the right should change but do not because the form items keep their internal state.
The text was updated successfully, but these errors were encountered:
Some elements needs to be re-created (and not just updated) when some defined context changes. For example, I have a widget where I can select different parts of an object, and I have next to it properties that applies to the selected object part. I need to recreate the input widgets when the selected part changes else they keep the context they are in and don't refresh properly.
I'm not alone in this as evidenced by this question: https://stackoverflow.com/questions/58187705/how-to-ensure-local-only-transitions-when-svelte-is-reusing-the-parent-dom-eleme/59047446#59047446
There is already a workaround available:
Describe the solution you'd like
A specific svelte syntax to avoid the clumsy
{#each}
It could be a specific hash directive, or a specific parameter like
svelte:key=
.Describe alternatives you've considered
The workaround described above
How important is this feature to you?
Once I found the workaround, it's really enough. It's just clumsy and you want to find something better for code style.
Additional context
Source code: https://github.com/mildred/calcul-meubles/blob/a8fbc7eefe8cbbb5bc44bb001adba19e887bff36/src/ensembles/Caisson.svelte#L922
Here, when I change the selected box on the left, the properties on the right should change but do not because the form items keep their internal state.
The text was updated successfully, but these errors were encountered: