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

attach is used before it is defined #101

Closed sindreij closed 1 year ago

sindreij commented 1 year ago

Hi. In https://github.com/thisbeyond/solid-dnd/blob/1060f8d3bb29e967fff1f62d3b8de4f8ea882e76/src/create-pointer-sensor.ts#L28, attach is used before it is defined. It's defined on line 42. This is only an issue when onMount is called synchronously. For me that happens in tests (using vitest and @solidjs/testing-library). I think this could be solved by moving onMount and onCleanup below the definition of attach.

If you want to, I could create a reproduction and/or a pull-request. Please let me know how you want me to proceed.

martinpengellyphillips commented 1 year ago

Interesting. I imagine this is common across solidjs so I wonder if better to tackle holistically in the solid testing library?