SpatieMediaLibraryFileUpload not showing

I'm using Form Builder in a Livewire normal component.
I have this field:
SpatieMediaLibraryFileUpload::make('main_image')
->disk('media')
->acceptedFileTypes([
  'image/png', 'image/jpeg'
])
->enableDownload()
->collection('main-image'),

firstly, when I do submit I save the media like this:
foreach($this->main_image as $image) {
$course->addMedia($image)
->toMediaCollection('main-image','media');
}

At that point, media is saved successfully in the database, and attached correctly to the model.
When I refresh the page, the Spatie field looks like empty.
I have tried to add
use WithMedia;
public $mediaComponentNames = ['main_image'];
public $main_image;

but no changes are.
Any thought?
Was this page helpful?