Skip to content

Select with searchable option empty state #18529

@valpuia

Description

@valpuia

Package

filament/filament

Package Version

4.2.2

Laravel Version

12

Livewire Version

3

PHP Version

8.4

Problem description

When using searchable() with relationship() and preload() options, it display data for easy access. but when we don't have any data, it display empty state like image. This empty state is same as using ->options()

Image
Select::make('district_id')
    ->required()
    ->relationship(name: 'district', titleAttribute: 'name')
    // -> options(District::pluck('name', 'id')->toArray())
    ->searchable()
    ->preload()

Expected behavior

Since we preload() the data, if it's empty it should display empty state like below, maybe different message

Image

Steps to reproduce

Use select on any resource with relationship and make the related empty

Select::make('district_id')
    ->required()
    ->relationship(name: 'district', titleAttribute: 'name') // should be null
    // -> options(District::pluck('name', 'id'))
    ->searchable()
    ->preload()

Reproduction repository (issue will be closed if this is not valid)

https://github.com/filamentphp/demo

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    Todo

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions