Dispatch event from afterStateUpdated to another field?

Hey guys, I have a builder field with a afterStateUpdated function where I want to dispatch the current value to a custom field. I tryed livewire listener but this didnt worked.

Is this possible? Or could I force a rerender of the custom field by manipulating its state?

Thanks.

Builder::make('content')
->blocks(
PageBlocks::make())
->live()
->afterStateUpdated(function(Get $get, Set $set, Livewire $livewire) {
  $livewire->dispatch('updateData', $get('content'));
  $set('preview', $get('content'));
}),


    #[On('updateData')]
    public function updateData(array $data)
    {
        dd($data);
    }
Was this page helpful?