Replies: 1 comment 6 replies
-
I will investigate |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Livewire PowerGrid version
v6.3.0
Livewire version
v3.6.2
Laravel version
v12.3
Which PHP version are you using?
PHP 8.4
Which Theme are you using?
Tailwind
Have you published the resource files and customized them? (php artisan vendor:publish)
No
What is the problem?
The issue originates from the fact that the configuration array under
filter_attributes
directly contains closures that returnComponentAttributeBag
objects. While this implementation works at runtime, it inherently conflicts with Laravel's configuration caching mechanism, which attempts to serialize all configuration values usingvar_export()
. Since PHP closures are not serializable, running commands likephp artisan config:cache
will fail with aLogicException
indicating that configuration files are not serializable. Furthermore, any attempt to refactor this into class-based callables without an explicit resolution strategy results in PowerGrid views failing to access required array keys (e.g.,selectAttributes
) during rendering.In the process of addressing the serialization issue, I attempted to follow the approach suggested in PR #1898 by defining the
filter_attributes
configuration like this:This change aimed to make the configuration fully serializable and compatible with
php artisan config:cache
, aligning with the method proposed in the mentioned PR. However, when using this pattern, PowerGrid views failed to properly resolve the callable and threw errors such as:This indicates that PowerGrid, at runtime, was attempting to use the class string directly as an array or callable without instantiating or invoking it, leading to missing attributes expected by the view components. Despite being consistent with the PR recommendation, this pattern alone wasn't sufficient to make the feature work without further adjustments to how PowerGrid resolves these filter attribute classes internally.
Code snippets
How do you expect it to work?
I would like to ask for help to properly address this issue.
It seems that the system is trying to access
['selectAttributes']
on the raw string instead of invoking the class.Could anyone advise:
::class
approach?Any guidance or example would be highly appreciated. Thank you!
Please confirm (incomplete submissions will not be addressed)
Beta Was this translation helpful? Give feedback.
All reactions