Skip to content

[LiveComponent] onUpdated hook is not called on formValues #2529

Open
@norkunas

Description

@norkunas

I am using ComponentWithFormTrait and need to save submitted values (draft mode until full form submit).
So I though that overriding $formValues and adding a hook will work. But that's not the case 🤔

class Component {
    // ...

    #[LiveProp(writable: true, fieldName: 'getFormName()', onUpdated: 'formValuesUpdated')]
    public array $formValues = [];

    public function formValuesUpdated(): void
    {
        // never called
    }
}

Is there a better way to hook for this?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions