Feature Regression in v4 Select Component: Rendering a Blade View for noSearchResultsMessage

Hi I've encountered a feature regression from v3 that was extremely valuable for our application's user experience The Use Case: "Quick Create" from a Select Dropdown In Filament 3, we could use noSearchResultsMessage in conjunction with allowHtml to render a full, interactive Blade view when a user's search yielded no results. This was perfect for a "quick create" feature. For example, if a user searched for a customer's phone number that didn't exist, a button would appear allowing them to create that customer on the fly without leaving the form How it Worked in Filament 3 We would define our Select component like this
Select::make('customer_id') ->searchable() ->allowHtml() ->noSearchResultsMessage(fn(Select $component) => new HtmlString( view('components.select-quick-create', [ 'statePath' => $component->getStatePath(), ]) ));
And our select-quick-create.blade.php component contained Alpine.js and Livewire actions: ```html <div x-data="{}"> <p>No customer found.</p> <button x-on:click.prevent="$wire.quickCreateCustomer()"> Create & Select "<strong x-text="select.input.value"></strong>" </button> </div> The Issue in Filament 4: In Filament 4 for understandable security reasons (preventing XSS) the noSearchResultsMessage now treats its content as plain text The same code now renders the raw HTML tags as a string or simply [object Object] if an HtmlString object is passed The allowHtml() method no longer affects this behavior This removes the ability to create this seamless "quick create" UX directly within the dropdown Would it be possible to introduce a new dedicated method for this functionality that explicitly renders a Blade view? This would restore the powerful UX pattern in a secure and deliberate way Something like ->searchNotFoundView(view.name) or ->noSearchResultsView('view.name') would be an amazing addition and would align with other ...View() methods in the framework
3 Replies
Mohamed KhX
Mohamed KhXOP2mo ago
in filament 3, it was working like that
No description
Mohamed KhX
Mohamed KhXOP2mo ago
in filament 4
No description
Dan Harrin
Dan Harrin2mo ago
I would accept a PR to render the text as HTML if an Htmlable object is passed

Did you find this page helpful?