diff --git a/resources/views/components/ui/filelist.blade.php b/resources/views/components/ui/filelist.blade.php
index 9cc7448..22649ea 100644
--- a/resources/views/components/ui/filelist.blade.php
+++ b/resources/views/components/ui/filelist.blade.php
@@ -8,8 +8,8 @@
@endphp
@if($value !== '' || $editor === true)
-
-
{{ $label }}
+
+
{{ $label }}
-
@@ -50,22 +50,18 @@
Alpine.store('files', []);
- // Check if result is a string or a collection
- if (typeof result === 'string') {
- result = result.split(',').filter((item) => item.length > 0);
-
- Promise.all(result.map(fileName => new Promise(resolve => {
- SM.mediaDetails(fileName, (details) => {
- resolve(details);
+ // Check if each item in result is a string or an object
+ result.forEach(item => {
+ if (typeof item === 'string') {
+ // If item is a string, get file details
+ SM.mediaDetails(item, (details) => {
+ Alpine.store('files', [...Alpine.store('files'), details]);
});
- }))).then(detailsArray => {
- Alpine.store('files', detailsArray);
- });
-
- } else if (Array.isArray(result)) {
- // If result is a collection, directly place it in the store
- Alpine.store('files', result);
- }
+ } else {
+ // If item is an object, directly place it in the store
+ Alpine.store('files', [...Alpine.store('files'), item]);
+ }
+ });
const elem = document.getElementById('{{ $name }}');
if(elem) {