Set the checkboxes for a Filament Checkboxlist based on another field value and a relationship

I have a Laravel Filament Checkboxlist named contact_ids:

CheckboxList::make('contact_ids')
    ->reactive()
    ->options([])
    ->searchable()
    ->columns(1),

I want to display the checkboxes that appear on this list based on a relationship:

public function contacts(): HasManyThrough {
    return $this->hasManyThrough(Contact::class, Client::class);
}

I’ve tried to add some reactivity to my Select::make('client_id') like this:

Select::make('client_id')
    ->relationship('client', 'name')
    ->searchable(['name'])
    ->preload()
    ->required()
    ->reactive()
    ->createOptionForm(Client::getForm())
    ->afterStateUpdated(function ($set, $state) {
                              // Update the options for the contact_ids CheckboxList based on the selected client
                              $set('contact_ids', []); // Clear the selected contacts when the client changes
                              $contacts = Contact::where('client_id', $state)->pluck('last_name', 'id');
                              $set('contact_ids.options', $contacts); // Update the options for the CheckboxList
                          }),

But this does not update the checkboxlist.