DEV Community

Discussion on: Drag and drop with Svelte using svelte-dnd-action

Collapse
 
c0dehamster profile image
Sergej Smelov • Edited

May I ask how to synchronize the items list with a store?

I tried naive approach such as

import { ListStore } from "./ListStore"

let items = $ListStore

const handleSortEnd = e => {
items = e.detail.items
ListStore.set(items)
}

but got a bizarre case of double headings in draggable elements

Update: here is full code
github.com/c0dehamster/drag-and-dr...

Collapse
 
isaachagoel profile image
Isaac Hagoel

You should be able to use the store directly and with no problem. Feel free to create a github issue with a Repl link

Collapse
 
c0dehamster profile image
Sergej Smelov

Thank you, I figured out how to connect to the store, is was actually very easy. Works as intended now