spatie / medialibrary.pro

The source code of medialibrary.pro
https://medialibrary.pro
36 stars 9 forks source link

Sort on x-media-library-collection stops working after 15 items #46

Closed scottmetoyer closed 2 years ago

scottmetoyer commented 2 years ago

I am seeing strange behavior on a Laravel Livewire project I inherited that uses the x-media-library-collection component.

Everything works perfectly if the media collection is 15 or less items in size. Collections with 16 or more items will not drag/sort correctly. After a drag is completed the list will resort itself randomly and not retain the set order. Looking at the media table shows values in the order_column that do not match what I'm seeing on the screen. I'm on version 1.17.7 of Media Library Pro.

Any ideas what I'm doing wrong?

freekmurze commented 2 years ago

That's strange. I tried to recreate the problem using our demo app, but it seems to be working. Could you try it there as well?

https://github.com/spatie/laravel-medialibrary-pro-app

CleanShot 2022-03-24 at 10 29 48@2x
scottmetoyer commented 2 years ago

Interesting - I was able to duplicate the behavior on the demo app, but I did need to use the older php7.4 branch as that's closer to what I have set up in my dev and prod environments.

Basically I added a bunch of items to the collection like this (I added 24 here):

Screen Shot 2022-03-24 at 10 05 54 AM

Then I grabbed the top item and moved it down 2 spots. After doing that the list reordered itself in an apparently totally random way:

Screen Shot 2022-03-24 at 10 07 43 AM

If I start removing items from the list, at exactly 16 items sort started working correctly again. Really strange!

massimomarazzi commented 2 years ago

Hi There, same here, when upload 16+ media then save and after reoder one media, other media are sorted randomly....

Laravel 8.74 Php 7.4.28 medialibrary 9.11.2 medialibrary-pro 1.17.13

I'am using livewire component .

I have updated the screencast with some other tests

EDIT: Updated screencast with more details. https://web.tresorit.com/l/UHk4Z#K1qJfC6YtmNIYWp2KEgyfw

spatie-bot commented 2 years ago

Dear contributor,

because this issue seems to be inactive for quite some time now, I've automatically closed it. If you feel this issue deserves some attention from my human colleagues feel free to reopen it.