Here is the problem I am facing in the simplest form
First time i click a button i see in network than all children of the same level and the parents of the are called.
When I click that button again, all the children of the same level are called like I would expect, but nothing goes down. so parent and grand parents are not called (and not updated)
this is how the grand-parent builds the parents
</td>
</tr>
and this is how the parent build the children
@foreach($campaignOrderDetail->campaignOrderDetailCampaignOrderDetailProducts as $campaignOrderDetailProduct)
<td>
@livewire('campaign-order-detail-product', [$campaignOrderDetailProduct])
</td>
@endforeach
</tr>
this is the entire child blade
this is the clicked function
public function clicked()
{
$this->emit(‘coucou’, $this->campaignOrderDetailProduct);
}
and the listeners in the component
protected $listeners = [‘coucou’ => ‘coucou’];
this is the coucou function
public function coucou(CampaignOrderDetailProduct $campaignOrderDetailProduct)
{
if ($campaignOrderDetailProduct->campaign_order_detail->id == $this->campaignOrderDetailProduct->campaign_order_detail->id) {
if ($campaignOrderDetailProduct->id == $this->campaignOrderDetailProduct->id) {
$this->isDark = 1;
$this->campaignOrderDetailProduct->quantity = 1;
$this->campaignOrderDetailProduct->extended_price = $this->campaignOrderDetailProduct->unit_price ;
} else {
$this->isDark = 0;
$this->campaignOrderDetailProduct->quantity = 0;
$this->campaignOrderDetailProduct->extended_price = 0;
}
$this->campaignOrderDetailProduct->save();
$this->emitUp('refreshTotal');
}
}
this is the listeners in the parent
protected $listeners = [‘refreshTotal’ => ‘refreshTotal’];
and the function
public function refreshTotal()
{
$this->lineTotal = $this->campaignOrderDetail->campaignOrderDetailCampaignOrderDetailProducts()->sum(‘extended_price’);
}
same logic from parent to grand parent is applied emitUp.
I even made sure the event name in parent and grand parent is different and function names also, from each others and from listener name