$this->registerListeners([
'repeater::createItem' => [
function (Repeater $component, string $statePath): void {
if ($statePath !== $component->getStatePath()) {
return;
}
$newUuid = (string) Str::uuid();
$livewire = $component->getLivewire();
data_set($livewire, "{$statePath}.{$newUuid}", []);
$component->getChildComponentContainers()[$newUuid]->fill();
$component->collapsed(false, shouldMakeComponentCollapsible: false);
$livewire->emit('newRepeaterItemID', $newUuid);
$livewire->emit('newRepeaterItem', $statePath);
},
],
$this->registerListeners([
'repeater::createItem' => [
function (Repeater $component, string $statePath): void {
if ($statePath !== $component->getStatePath()) {
return;
}
$newUuid = (string) Str::uuid();
$livewire = $component->getLivewire();
data_set($livewire, "{$statePath}.{$newUuid}", []);
$component->getChildComponentContainers()[$newUuid]->fill();
$component->collapsed(false, shouldMakeComponentCollapsible: false);
$livewire->emit('newRepeaterItemID', $newUuid);
$livewire->emit('newRepeaterItem', $statePath);
},
],