thisbeyond / solid-dnd

A lightweight, performant, extensible drag and drop toolkit for Solid JS.
https://solid-dnd.com
MIT License
516 stars 34 forks source link

SortableProvider doesn't like "0" as an ID #116

Open benbriedis opened 4 months ago

benbriedis commented 4 months ago

I have an example here: https://stackblitz.com/edit/solidjs-templates-uekvqb If you drag around the row with the '0' ID then a gap is not made for it in the list. You can drop the item OK.

martinpengellyphillips commented 3 months ago

Thanks for the report and reproduction. I'll take a look.

martinpengellyphillips commented 3 months ago

From a quick look I imagine it is caused by this naive check here: https://github.com/thisbeyond/solid-dnd/blob/809014fa9ea058ab3cf54ad9d855970b7fd866ab/src/sortable-context.tsx#L44

I'll fix that to be stricter (and avoid treating a 0 as a false evaluation).

floratmin commented 3 weeks ago

From a quick look I imagine it is caused by this naive check here:

https://github.com/thisbeyond/solid-dnd/blob/809014fa9ea058ab3cf54ad9d855970b7fd866ab/src/sortable-context.tsx#L44

I'll fix that to be stricter (and avoid treating a 0 as a false evaluation).

Yes this fix works.