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
18.09k stars 2.83k forks source link

ToggleColumn flickers if toggling between null and non-null value #7226

Closed mokhosh closed 10 months ago

mokhosh commented 1 year ago

Package

filament/filament

Package Version

Laravel Version

Livewire Version

PHP Version

Problem description

When you use ToggleColumn to toggle between a null and a nonnull value, the toggle input flickers.

Expected behavior

The toggle should not flicker.

Steps to reproduce

Just add this to a newly created UserResource

Tables\Columns\ToggleColumn::make('email_verified_at')
    ->updateStateUsing(function ($state, $record) {
        $record->email_verified_at = $state ? now() : null;
        $record->save();

        return $state;
    }),

Reproduction repository

https://github.com/mokhosh/filament-v3-bug-reproduction

Relevant log output

No response

zepfietje commented 1 year ago

Please provide more details like a screen recording to explain what you mean with the toggle flickering. Since the disabled styling is applied when the toggle state gets pushed to the back end, that could be the flicker.

I'll reopen the issue if it really is a bug and you provide more evidence of that. Thanks. 🙂

mokhosh commented 1 year ago

You can add screen recordings to the long list of required parameters for new issues 😄

No, it's not the disabled state, that's actually a very good feedback. It's flicker:

https://github.com/filamentphp/filament/assets/6499685/e2e960f9-57d4-486f-8f5d-3a78cef80190

mokhosh commented 1 year ago

I've also done the reproduction repository btw which should be easy to check.

zepfietje commented 1 year ago

I've also done the reproduction repository btw which should be easy to check.

Yeah thanks, though I wanted to be sure what you meant exactly. It's clear to me now and seems like a bug indeed.

I'm still working on revamping the toggle and toggle column components, so possibly this will be fixed soon. Still, I'll reopen this issue.

sumardi commented 1 year ago

I can confirm this bug exists with or without calling updateStateUsing().

zepfietje commented 1 year ago

Thanks for that info, @sumardi! 😄 I'll be looking into that column real soon now.

fgschafer commented 1 year ago

Hi, is there any follow up on this? I'm also facing the same flickering

zepfietje commented 1 year ago

Not as far as I know. We're working through more urgent bugs first.

Feel free to look into this issue and attempt a PR though. Always happy to review. 😊