helpertext hide after selecting other select field

Why does the helper text for the "bank" field disappear when I choose the "expense type"?

Code

  public static function form(Form $form): Form
    {
        return $form
            ->schema([

                Textarea::make('detail')->maxLength(350)->required(),

                DatePicker::make('date')
                    ->format('Y-m-d')
                    ->default(date('Y-m-d'))
                    ->required(),

                Forms\Components\TextInput::make('amount')
                    ->numeric()
                    ->inputMode('decimal')
                    ->required(),

                Select::make('expense_type')
                    ->searchable()
                    ->options([
                        'Operating Expense' =>  Account::where('account_type', Account::OPERATING_EXPENSE)->pluck('name', 'id')->toArray(),
                        'Direct Expense' => Account::where('account_type', Account::DIRECT_EXPENSE)->pluck('name', 'id')->toArray(),
                        'Overhead Expense' => Account::where('account_type', Account::OVERHEAD_EXPENSE)->pluck('name', 'id')->toArray(),
                        'Other Expense' => Account::where('account_type', Account::OTHER_EXPENSE)->pluck('name', 'id')->toArray(),
                    ]),

                Select::make('bank')
                    ->searchable()
                    ->options(
                        Account::where('account_type', Account::BANK)->pluck('name', 'id')->toArray()
                    )->afterStateUpdated(function (?string $state, ?Component $component) {

                        $balance  = number_format((Account::find($state)->currentBalance(Carbon::yesterday(), Carbon::tomorrow()))[1], 2);
                        $component->hint("Current balance of account : {$balance}");
                        $component->hintColor($balance < 0 ? 'danger' : 'primary');
                    }),

            ]);
    }
helpertext.gif
Was this page helpful?