Feb 23, 2024
0
Level 1
livewire/update?... Not found
I have been at this problem for hours now... I can't seem to figure it out.
I have a modal Volt component
<?php
use Livewire\Volt\Component;
use Livewire\Attributes\On;
new class extends Component {
public $name = '';
public $user;
#[On('edit-name')]
public function edit_name($name)
{
$this->user = Auth::user();
$this->name = $name;
$this->dispatch('open-modal', 'name-form-modal');
}
#[On('create-name')]
public function create_name()
{
$this->name = '';
$this->user = null;
$this->dispatch('open-modal', 'name-form-modal');
}
...
};
?>
<x-modal name="name-form-modal" :show="false">
<h1>{{ $name ? 'Update' : 'Create' }} Name</h1>
<form wire:submit="...">
</form>
</x-modal>
In the parent component
<button type="button" @click="$dispatch('create-name')">Create</button>
<button type="button" @click="$dispatch('edit-name', { name: 'My name' })">Edit</button>
@teleport('body')
<livewire:name-form-modal key="nf-modal" wire:key="nf-modal" />
@endteleport
The problem is: When I click the Edit button the modal opens up just fine. After closing, then clicking again gives the error livewire/update?... : ... not found
Please or to participate in this conversation.