I am building a component using Svelte in which you have a list of words and you have to arrange them in the correct order by dragging the words to the answer section, for this, I am using SortableJS.

To store the answer and the words you can use I use svelte stores and everything works correctly. Now, I am trying to do the same but with an ʻonClick` event. But I have a bug where the store values are updated but the view does not.
To show the options and the answers I am doing this:
<divclass="chips"
use:sortable="{{ items: answer, options: { group: 'chips', forceFallback: false } }}"
>
{#each get(answer) as chip, index}
<spanclass="chip" on:click="{handleAnswerClick(chip, index)}"><spainclass="tag is-medium">{chip}</spain></span>
{/each}
</div>and if I replace the get in {#each get (answer) as chip, index} with $answer, the ʻonClick` event works but now the drag behaves strangely and with bugs.
Here is a codesandbox with both of the alternatives explained above
Reproduction
Scenario
https://codesandbox.io/s/sortable-bug-0lmd8
Version
| package | version |
|---|
sortablejs | 1.12.0 |
@types/sortablejs | N/A |
I am building a component using Svelte in which you have a list of words and you have to arrange them in the correct order by dragging the words to the answer section, for this, I am using SortableJS.
To store the answer and the words you can use I use svelte stores and everything works correctly. Now, I am trying to do the same but with an ʻonClick` event. But I have a bug where the store values are updated but the view does not.
To show the options and the answers I am doing this:
and if I replace the
getin{#each get (answer) as chip, index}with$answer, the ʻonClick` event works but now the drag behaves strangely and with bugs.Here is a codesandbox with both of the alternatives explained above
Reproduction
Scenario
https://codesandbox.io/s/sortable-bug-0lmd8
Version
sortablejs1.12.0@types/sortablejs