outl1ne / nova-sortable

This Laravel Nova package allows you to reorder models in a Nova resource's index view using drag & drop.
MIT License
283 stars 120 forks source link

Issues when using with Octane and Duplicates item #190

Open g124578g opened 1 year ago

g124578g commented 1 year ago

The first issue is that when used with Octane, "move_to_start" and "move_to_end" cannot function correctly, but it works properly when started using "php artisan serve.

The second issue is that when dragging to reorder, duplicate items appear at the bottom. This problem doesn't occur in Safari, but it does in Chrome.

LuckyLukas98 commented 9 months ago

I've also experienced your first issue using Laravel Octane. It seems to somehow be related to the sortable cache.

Adding the public static $sortableCacheEnabled = false; to the resource fixed it for me.

LuckyLukas98 commented 9 months ago

This might be related to the static variable used for caching in the HasSortableRows Trait.

Using Octane this variable will be initialized once, stored in RAM and used for subsequent request, which could explain why moving items to to start or to the end will result in the same order as before.