Fix User column searchable() callback for Filament 5.7.8 - #40
Merged
Conversation
Filament table TextColumn::searchable() treats the first argument as a condition (bool|array|string|Closure), not the search query. Passing a closure there makes isSearchable() evaluate it during table render. In Filament 5.7.8 that evaluation injects a null $query, causing "Call to a member function where() on null". Pass the custom user-name search as the query: argument so the column stays searchable without running the SQL callback on render.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Details
Filament table
TextColumn::searchable()first argument is a condition (bool|array|string|Closure), not the search query. The second argument (query) is the custom search callback.LibraryItemPermissionsRelationManagerpassed afunction ($query, $search)as the first argument. Filament therefore treated it asisSearchableand evaluated it during table render.In Filament 5.7.8 that evaluation injects
$queryasnull, which crashes host apps (e.g. Communities-of-ExcellenceResourceLibraryContractTest) with:at
LibraryItemPermissionsRelationManager.phpin the searchable closure.Fix
Pass the custom user-name search via the named
query:argument so:Release
This needs a tagged release (v1.4.1) so Packagist consumers can bump. Communities PR https://github.com/TappNetwork/Communities-of-Excellence/pull/193 will consume this commit until that release is published.