volt icon indicating copy to clipboard operation
volt copied to clipboard

Updated hook not triggered on array property

Open undjike opened this issue 1 year ago • 0 comments

Volt Version

1.6.3

Laravel Version

11.7.0

PHP Version

8.3.8

Database Driver & Version

Not applicable

Description

updated([
    'profiles' => function () {
        // Not triggered
    },
    'profiles.0' => function () {
        // Triggered when key 0 changed
    }
]);
@foreach(Profile::cases() as $profile)
      <input type="checkbox"
                  wire:model.live="profiles"
                  value="{{ $profile->name }}"
                  class="sr-only peer"
                  id="user-assigned-{{ $profile->name }}">
@endforeach

The problem is there could be several keys in the array and I don't know which might change. I want to track any changes on the array an execute an action.

Steps To Reproduce

Create a Volt component an listen to the updated hook on an array property (wired to a checkbox in this case).

undjike avatar Jun 25 '24 05:06 undjike