@forrestedw Not sure if it has something to do with it, but try using wire:model.lazy (without debounce). How do you check if the values have changed or not? I just tried a minimum example and it seems fine.
Livewire forgetting an array value when the model updates.
I have a blade loop in a Livewire component that looks like this:
@foreach($variants as $key => $variant)
<div class="inline-flex justify-between w-full mb-2">
<input wire:model.debounce.lazy="variants.{{ $key }}.name">
<input wire:model.debounce.lazy="variants.{{ $key }}.values">
</div>
@endforeach
When I update a value on the array, it forget the previous updates.
For examples, if I change the value of variants.1.name from foo, the value when the component was mounted, to bar then for that moment $this->variants[1]['name'] === bar is true.
However, if I then change the input value of eg variants.0.name to baz, then $this->variants[1]['name'] goes back to the value of foo, the value it had when the component was mounted.
How do I get the array to hold all the changes that are passed back from the browser, not just he most recent?
Yes, the properties are public
@forrestedw Indeed, when using updated I've got the same behaviour, but when I add a button with some action wire:click="test" and dump($this->variants); in there it works as expected. Do you have to use updated in order to achieve what you want?
Please or to participate in this conversation.