You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Images are reordered so that 01JMF06G5WXKAVQGZC9NP8YXAT.jpg is first.
In DB this is stored with 01JMF06G5WXKAVQGZC9NP8YXAT.jpg with the larger sort order in order_column (which seems potentially incorrect).
When viewing field, the last one is shown rather than the first.
Expected behavior
You would expect the table column to correctly return the first sorted media item in the same order as the field sorts them, however it currently returns the last.
Steps to reproduce
Create a multiple() and reorderable() Media Field
Re-order via the UI and save
View the table field
Reproduction repository (issue will be closed if this is not valid)
To follow up on this, I tracked down the issue to the shouldAppendFiles property inside the Alpine file-upload.js component. If shouldAppendFiles is false then it reverses the sort order of the returned keys:
this.pond.on('reorderfiles',async(files)=>{constorderedFileKeys=files.map((file)=>file.sourceinstanceofFile
? file.serverId
: (this.uploadedFileIndex[file.source]??null),)// file.serverId is null for a file that is not yet uploaded.filter((fileKey)=>fileKey)awaitreorderUploadedFilesUsing(shouldAppendFiles
? orderedFileKeys
: orderedFileKeys.reverse(),)})
However this reversed order is not taken into account in the Livewire component:
Package
filament/spatie-laravel-media-library-plugin
Package Version
v3.2.134
Laravel Version
v11.39.1
Livewire Version
No response
PHP Version
8.3.15
Problem description
Currently if using
multiple()
andreorderable()
media, the sortable order seems to be stored inverted.For example:
In form:
In table:
Images are reordered so that
01JMF06G5WXKAVQGZC9NP8YXAT.jpg
is first.In DB this is stored with
01JMF06G5WXKAVQGZC9NP8YXAT.jpg
with the larger sort order inorder_column
(which seems potentially incorrect).When viewing field, the last one is shown rather than the first.
Expected behavior
You would expect the table column to correctly return the first sorted media item in the same order as the field sorts them, however it currently returns the last.
Steps to reproduce
multiple()
andreorderable()
Media FieldReproduction repository (issue will be closed if this is not valid)
https://github.com/Muffinman/filament-issue
Relevant log output
The text was updated successfully, but these errors were encountered: