Skip to content

[LiveComponent] Embeded stimulus controller in a live form not working on re-render #489

Closed
@tdumalin

Description

@tdumalin

Hi,

I want to use symfony live component to render a form and use some other controller embeded in the form.
Some example may be to use a datepicker. I used this one: https://www.npmjs.com/package/stimulus-datepicker
I've managed to use the controller in the form but when i change an input the component re-render is triggered and the stimulus controller doesn't work anymore.

A solution may be to use data-live-ignore but in my project i use this picker in a LiveCollectionType entry so i need the controller to be connected after a re-render

I've created a mini project to show the problem:
https://github.com/tdumalin/bug-live-component.git

Installation (assumes that php, symfony cli,composer and yarn are installed):

git clone https://github.com/tdumalin/bug-live-component.git
composer update
yarn install
yarn build
symfony serve -d

http://127.0.0.1:8000/

When you click on "Toggle" the picker shows but if you change the select value and re-click on "Toggle" stimulus controller is not triggered anymore

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions