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] All onUpdated methods are triggered #2454

Open
jkgroupe opened this issue Dec 19, 2024 · 1 comment
Open

[LiveComponent] All onUpdated methods are triggered #2454

jkgroupe opened this issue Dec 19, 2024 · 1 comment
Labels
Bug Bug Fix LiveComponent Status: Waiting Feedback Needs feedback from the author

Comments

@jkgroupe
Copy link

Hello,

I am using live components on Symfony 6.4 and when I add onUpdated parameters, all methods are triggered when I update just one element

Live Component

#[AsLiveComponent]
class RevenueChart
{
    use DefaultActionTrait;

    #[LiveProp(writable: true, onUpdated: 'onChangeYear')]
    public ?int $currentYear = null;

    #[LiveProp(writable: true, onUpdated: 'onChangeTarget')]
    public float $currentTarget = 0.0;

    public function onChangeTarget($oldValue): void
    {
        var_dump($oldValue);
    }

    public function onChangeYear($oldValue): void
    {
        var_dump($oldValue);
    }
}

Twig
<select data-model="on(change)|currentYear" id="year"></select>

<input type="number" data-model="on(change)|currentTarget" class="form-control" id="target" />

I don't know if I'm missing something but it doesn't work in my case

Thanks for your help

@jkgroupe jkgroupe added the Bug Bug Fix label Dec 19, 2024
@smnandre
Copy link
Member

I could not reproduce your problem, could you provide a github repository with a minimal symfony app showing the issue happenign ?

@smnandre smnandre added Status: Waiting Feedback Needs feedback from the author and removed Status: Needs Review Needs to be reviewed labels Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Bug Fix LiveComponent Status: Waiting Feedback Needs feedback from the author
Projects
None yet
Development

No branches or pull requests

3 participants