ariaieboy / filament-currency

Enhanced Currency Related stuff for Filament
MIT License
49 stars 8 forks source link

[Bug]: Issue using Filament reactive fields #30

Closed quinleys closed 5 months ago

quinleys commented 5 months ago

What happened?

Hi,

When using reactive fields to set a currency masked field (Field X). Field X display nothing when logging in the 'afterStateUpdated' the value of the state is NULL and the value of the old state is the desired state for some reason.

\Filament\Forms\Components\TextInput::make('full_commission_amount')
->numeric()
->currencyMask()
->afterStateUpdated(function (?string $state, ?string $old) {
      info([$state, $old]);
// returns 
// [  0 => NULL,
// 1 => '1000',]
  })

How to reproduce the bug

// Field on updated currency field (full_commission_amount) on afterStateUpdate
   \Filament\Forms\Components\TextInput::make('commission_percentage')
      ->afterStateUpdated(fn(Forms\Get $get, Forms\Set $set) => self::updateProjectCalculations($set, $get))
// here the $set value can't be seen
\Filament\Forms\Components\TextInput::make('full_commission_amount')
 ->numeric()
 ->currencyMask()

Package Version

1.7.3

PHP Version

8.2

Laravel Version

11.4

Which operating systems does with happen with?

No response

Notes

No response

ariaieboy commented 5 months ago

test 1.7.4