solid-dnd-directive
solid-dnd-directive copied to clipboard
Is there a way to avoid re-creating the dropped item?
Is there a way to move the dropped component rather than creating it anew?
Not sure i understand. Verbose mode please.
On Sat, Mar 19, 2022, 10:13 Michael Floering @.***> wrote:
Is there a way to "move" the dropped component rather than creating it anew?
— Reply to this email directly, view it on GitHub https://github.com/isaacHagoel/solid-dnd-directive/issues/8, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE4OZC4EM2TOU5VWPHG3GKLVAUE3JANCNFSM5RDDUCAA . 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 are subscribed to this thread.Message ID: @.***>
At least from following the examples, it seems when dropping an item, the component always gets re-evaluated or re-created. I'm wondering if there's a way to memoize that, or unmount-and-remount, rather than it being a fresh child component. But I might be thinking about this wrong...
I'll make a quick codesandbox to show the behavior I'm asking about.
Here's a quick contrived example. When you drop the item, notice that the timestamp is different / more recent. https://codesandbox.io/s/demonstration-of-component-re-creation-upon-drop-pp82gj?file=/src/App.jsx
Is there a way to make it so the same component instance is used, upon drop? In terms of the example, if the same component instance was used, the timestamp would not change (since Solid.js does not re-execute the actual component functions except when the component is [re-]created)