Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
norkunas opened this issue Jan 27, 2025 · 2 comments
Open

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

norkunas opened this issue Jan 27, 2025 · 2 comments
Labels

Comments

@norkunas
Copy link
Contributor

norkunas commented Jan 27, 2025

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?

@norkunas norkunas added the Bug Bug Fix label Jan 27, 2025
@smnandre
Copy link
Member

PostHydrate ?

@norkunas
Copy link
Contributor Author

Thanks. it's a minus that I can't inject Request and need to interact with RequestStack..
But why onUpdated hook does not work here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants