Throw a descriptive error in development when non-string IDs are passed to useSortable or SortableContext
The current behavior of the library when passed non-string IDs for sortable items can be confusing, see https://github.com/clauderic/dnd-kit/issues/604 and https://github.com/clauderic/dnd-kit/discussions/357#discussioncomment-1018851 for additional context.
I plan to add runtime checks to the useSortable and SortableContext hook that will throw a descriptive error in development environments only when the id passed to useSortable is a non-string value, or the items array passed to <SortableContext> contains non-string values. Hopefully this will save future users of the library the debugging headaches that I went through over the past couple of days.
I just wasted a bunch of hours due to this very frustrating issue (and never would have figured it out without looking through these github issues), so thank you for working on this!
Oops, thanks for the reminder Matt. This fell off my radar.
On Tue, Apr 26, 2022 at 10:24 AM Matt Lyon @.***> wrote:
I just wasted a bunch of hours due to this very frustrating issue (and never would have figured it out without looking through these github issues), so thank you for working on this!
— Reply to this email directly, view it on GitHub https://github.com/clauderic/dnd-kit/issues/606#issuecomment-1110060727, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACUYNJXSJWXTGHU2UGQQA3VHARGDANCNFSM5M3TGWOA . You are receiving this because you were assigned.Message ID: @.***>
I believe this can be considered resolved, now that numeric IDs are accepted!
Also, for anyone above that's run into this type of issue recently - just use TypeScript, it's extremely worth the initial startup cost to wrapping your head around the type system, especially when it comes to working with unfamiliar libraries like this situation. If I had used it for my project, I wouldn't have run into this error in the first place.