filamentphp / filament

A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS.
https://filamentphp.com
MIT License
19.3k stars 2.96k forks source link

$dataChecksum error on updatedFilter #5237

Closed studio-creativo closed 1 year ago

studio-creativo commented 1 year ago

Package

filament/filament

Package Version

v2.16.19

Laravel Version

v9.33.0

Livewire Version

v2.10.7

PHP Version

PHP 8.0.21

Problem description

I created a chart widget that works correctly after mount, but when I hit the filter button the chart doesn't refresh and instead I get this error: Typed property Filament\Widgets\ChartWidget::$dataChecksum must not be accessed before initialization

I tried to add this on top of my widget class: public string $dataChecksum = ''; And if i add an empty string to this variable the chart works.

Expected behavior

I can update the chart when hit the filter button.

Steps to reproduce

Create a new chart widget, add some data and filters as the documentation says and try to update the chart hitting the filter.

Reproduction repository

https://github.com/filamentphp/filament

Relevant log output

No response

github-actions[bot] commented 1 year ago

Hey @studio-creativo! We're sorry to hear that you've hit this issue. 💛

However, it looks like you forgot to fill in the reproduction repository URL. Can you edit your original post and then we'll look at your issue?

We need a public GitHub repository which contains a Laravel app with the minimal amount of Filament code to reproduce the problem. Please do not link to your actual project, what we need instead is a minimal reproduction in a fresh project without any unnecessary code. This means it doesn't matter if your real project is private / confidential, since we want a link to a separate, isolated reproduction. That would allow us to download it and review your bug much easier, so it can be fixed quicker. Please make sure to include a database seeder with everything we need to set the app up quickly.

AshishDhamalaAD commented 10 months ago

I also had the same issue. The widgets are lazily loaded by default. If you have more widgets on the dashboard and some of them are not in the view and then if we change the filters, we get this issue.

@studio-creativo for now, you can add this on your widget class and you won't get this error: protected static bool $isLazy = false;

I hope it helps