Select options not populating

Kindly assist, having challenge with my select form field, in searchable mode, it does not populate the options when in editing and only populates on create when I set default to empty string (''). What could be the issues?
No description
21 Replies
toeknee
toeknee5mo ago
Remove default() and add: preload() Does it show then?
Mastjoe
Mastjoe5mo ago
@toeknee just tried it but gives an empty options result
toeknee
toeknee5mo ago
What is your relationship function
Mastjoe
Mastjoe5mo ago
its a belongs to relationship : public function company() { return $this->belongsTo(Company::class); }
toeknee
toeknee5mo ago
Do you have any scopes on Company::class
Mastjoe
Mastjoe5mo ago
have only soft deletes used ->getSearchResultsUsing(...) and got same result
toeknee
toeknee5mo ago
Do you have telescope etc installed so you can see the query being run when searching?
Mastjoe
Mastjoe5mo ago
This is the screenshot from telescope its responding fine from the endpoint but the options are not populate on the client side
No description
Mastjoe
Mastjoe5mo ago
on the browser console, I get this error:
No description
toeknee
toeknee5mo ago
But you want to look at the query
Mastjoe
Mastjoe5mo ago
the query seems fine or is there something am not doing right or missing?
LeandroFerreira
LeandroFerreira5mo ago
Are you using the panel builder or only the form builder?
Mastjoe
Mastjoe5mo ago
am using the panel builder
LeandroFerreira
LeandroFerreira5mo ago
Filament version?
Mastjoe
Mastjoe5mo ago
3.0
LeandroFerreira
LeandroFerreira5mo ago
current version is 3.2.28
Mastjoe
Mastjoe5mo ago
yeah am aware, we have some dependencies currently in used that is preventing us from upgrading to Laravel 10, which implies we cant use the latest filament version at the moment. Is this issue peculiar to the version?
LeandroFerreira
LeandroFerreira5mo ago
hum, I don't know. You could try the same resource on a fresh install using the current version
Mastjoe
Mastjoe5mo ago
Alright. Thanks. I will give it a try and see what becomes the outcome. @Leandro Ferreira just tried with a new project install and latest filament version and it works fine. @Leandro Ferreira found the issue for v3.0, actually a JS issue, it assumes the state will always be an array and when its is not, trying to use "includes" fxn fails. Is there a way I can have an exact copy or another edition of "public/js/filament/forms/components/select.js" with the fix published instead of that coming from filament vendor?
LeandroFerreira
LeandroFerreira5mo ago
If I were you, I would update laravel/filament
Mastjoe
Mastjoe5mo ago
Yeah I wish I could do same, its a legacy project with lots of dependencies that are not compatible with laravel 10 and currently in use.