Skip to content

fix: evaluate closures in the configured columns - #85

Merged
awcodes merged 1 commit into
4.xfrom
fix/columns-closures
Oct 31, 2026
Merged

awcodes merged 1 commit into
4.xfrom
fix/columns-closures

Conversation

@awcodes

@awcodes awcodes commented Oct 31, 2026

Copy link
Copy Markdown
Owner

Problem

93331e4 made the widget read its grid from OverlookPlugin::getColumnsConfig() instead of Filament's getColumns(), so the documented defaults (2 / 2 / 3 / 4 / 5 columns) finally apply when columns() is not called. In v4.1.1 the widget renders one column at every breakpoint.

getColumnsConfig() returned $this->columns without evaluating it, though. columns() accepts closures, so ->columns(fn () => 3) or ->columns(['md' => fn () => 3]) put a Closure into the widget's public $grid property, which Livewire cannot serialize. Both worked in v4.1.1.

Fix

Custom columns now resolve through getAllColumns(), which evaluates closures. Without custom columns, the defaults are unchanged.

columns() call v4.1.1 4.x before this PR
none 1 column 2/2/3/4/5 2/2/3/4/5
4 lg: 4 lg: 4 lg: 4
['sm' => 2, 'lg' => 4] same same same
fn () => 3 lg: 3 Closure lg: 3
['md' => fn () => 3] md: 3 Closure md: 3

Tests

A dataset test covers each shape. Both closure cases fail against the current 4.x and pass with the fix. composer test passes locally with phpstan 2.3.4 and rector 2.8.3.

🤖 Generated with Claude Code

getColumnsConfig() returned the stored columns as they were, so
->columns(fn () => 3) or ->columns(['md' => fn () => 3]) put a Closure
into the widget's public $grid property, which Livewire cannot
serialize. It now resolves custom columns through getAllColumns(), which
evaluates closures, and keeps the documented defaults when no columns
are set.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@awcodes
awcodes merged commit 2b2a8ae into 4.x Oct 31, 2026
12 checks passed
@awcodes
awcodes deleted the fix/columns-closures branch October 31, 2026 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant