question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

data array in store

See original GitHub issue

How can I use this library when the data array is actually stored in a writable store?

<script>
    import {flip} from "svelte/animate";
    import {dndzone} from "svelte-dnd-action";

    const flipDurationMs = 300;
    function handleDndConsider(e) {
        $items = e.detail.items;
    }
    function handleDndFinalize(e) {
        $items = e.detail.items;
    }
</script>

<section use:dndzone="{{$items, flipDurationMs}}" on:consider="{handleDndConsider}" on:finalize="{handleDndFinalize}">
    {#each $items as item(item.id)}
    <div animate:flip="{{duration: flipDurationMs}}">{item.name}</div>
    {/each}
</section>

where let’s say:

   items = [
        {id: 1, name: "item1"},
        {id: 2, name: "item2"},
        {id: 3, name: "item3"},
        {id: 4, name: "item4"}
    ];

is the data inside the store

When I try it I get errors.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
webdaggercommented, Feb 26, 2022

<section use:dndzone="{{items:$items, flipDurationMs}}" on:consider="{handleDndConsider}" on:finalize="{handleDndFinalize}">

0reactions
isaacHagoelcommented, Feb 27, 2022

Yeah look at the example in the readme. It is exactly for that. It doesn’t apply the transition while dragging only when adding/deleting elements

On Mon, Feb 28, 2022, 07:07 pj @.***> wrote:

The fading is actually for a non drag and drop reason.

— Reply to this email directly, view it on GitHub https://github.com/isaacHagoel/svelte-dnd-action/issues/358#issuecomment-1053664113, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE4OZC4KDYPSCSFKC5OC2KTU5KAADANCNFSM5PMQKXQQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

Read more comments on GitHub >

github_iconTop Results From Across the Web

Data Structures 101: Arrays — A Visual Introduction for ...
Arrays are classified as Homogeneous Data Structures because they store elements of the same type. They can store numbers, strings, boolean ...
Read more >
How to store value in array - Javatpoint
All arrays are the contiguous block of memory locations. By default, the lowest position of the array stores the first element, and the...
Read more >
How to store ordered data in arrays - Hacking with Swift
In Swift, we do this grouping using an array. Arrays are their own data type just like String , Int , and Double...
Read more >
Basic Data Structures: Use an Array to Store a Collection of Data
Basic Data Structures: Use an Array to Store a Collection of Data. All array's have a length property, which as shown above, can...
Read more >
How can I store data in a JavaScript Array so ... - Stack Overflow
getItem(yourArrayItemName ) , parse the content into array, modify that (by pushing necessary items), (over)write your local storage item with ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found