© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2w ago•
9 replies
Vp

afterStateUpdatedJS working differently after upgrade to v5

✅ SolvedPanels5️⃣v5
on filament v4, I have the following code which is working fine
Group::make()
    ->extraAttributes([
        'x-data' => <<<'JS'
            {
                calculateTotal() {
                    const first = parseFloat($get('first')) || 0;
                    const second = parseFloat($get('second')) || 0;

                    $set('total_amount', first + second);
                }
            }
        JS,
    ])
    ->schema([
        TextInput::make('first')
            ->required()
            ->afterStateUpdatedJs('calculateTotal()');
        TextInput::make('second')
            ->required()
            ->afterStateUpdatedJs('calculateTotal()');

        TextInput::make('total_amount')
            ->readOnly()
            ->required();
    ]),
Group::make()
    ->extraAttributes([
        'x-data' => <<<'JS'
            {
                calculateTotal() {
                    const first = parseFloat($get('first')) || 0;
                    const second = parseFloat($get('second')) || 0;

                    $set('total_amount', first + second);
                }
            }
        JS,
    ])
    ->schema([
        TextInput::make('first')
            ->required()
            ->afterStateUpdatedJs('calculateTotal()');
        TextInput::make('second')
            ->required()
            ->afterStateUpdatedJs('calculateTotal()');

        TextInput::make('total_amount')
            ->readOnly()
            ->required();
    ]),


After upgraded to filament v5 (with livewire v4) this calculation doesn't do anything at all. This maybe cause by livewire changes, but I am not sure which one cause it.

Any help is appreciated, and thanks in advance
Solution
This maybe a breaking changes (or bugs) between major version, I can confirm this is working on v4 and not working on v5 on new project. I will submit an issue with reproduction repo

For now I found a work around using alpine $watch..
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

defaultImageUrl not working after upgrade to v4
FilamentFFilament / ❓┊help
6mo ago
Validation with afterStateUpdatedJs()
FilamentFFilament / ❓┊help
4mo ago
Using both afterStateUpdated AND afterStateUpdatedJs
FilamentFFilament / ❓┊help
8mo ago
Has anyone tried Claude AI to upgrade FilamentPHP from v3 to v5
FilamentFFilament / ❓┊help
6d ago