afterStateUpdated() not running on custom component

I have custom Section component that is opened and collapsed using a checkbox. It works as expected.
I have multiple CheckboxSection components in my form and want to ensure that only 1 is open at a given time. Maybe i could achieve this by doing some checks in the afterStateUpdated() method on each checkbox?

The Problem - afterStateUpdated() doesnt seem to run on the checkboxes. On the example code below the $state is not dumped.

CheckboxSection::make('single')
  ->checkbox(
                Forms\Components\Checkbox::make('is_single')
                    ->label('Single Packaging')
                    ->live()
                    ->disabled(fn ($livewire): bool => ! $livewire->hasSinglePackagingOptions())
                    ->afterStateUpdated(fn ($state) => dump($state))
                    ->extraAttributes(function ($livewire, ?bool $state) {
                        if ($livewire->hasSinglePackagingOptions() && $state) {
                            return ['x-on:click' => "isCollapsed = true"];
                        }
                        if ($livewire->hasSinglePackagingOptions()) {
                            return ['x-on:click' => "isCollapsed = false"];
                        }
                        return [];
                    })
->description(fn (Get $get, $livewire): ?string => $get('limitation') ? ($livewire->hasSinglePackagingOptions() ? 'Permitted' : 'Not Permitted') : null)
            ->compact()
            ->collapsible() 
            ->collapsed(function (Get $get) {
                // code
            })
            ->schema([
                // code
            ])
Was this page helpful?