symfony / ux

Symfony UX initiative: a JavaScript ecosystem for Symfony
https://ux.symfony.com/
MIT License
851 stars 313 forks source link

[LiveComponent] UnexpectedTypeException when adding children with focus in put #638

Closed alexgaill closed 1 year ago

alexgaill commented 1 year ago

Hi, I have an embeded form with Live Component. When i want to add a children item with a focus input, an error occured.

I made a video for more informations.

Tell me if you need some code to understand that.

https://user-images.githubusercontent.com/47665701/210760261-862e238f-ceff-40af-8d78-cd47583fc446.mov

weaverryan commented 1 year ago

Hi!

Apologies for the slow reply - definitely some sort of a bug! 2 things:

1) I'm guessing that the Nom field is being updated in "change", is the correct? What does that field look like - especially the data-model part? And, am I correct to assume that the + Ajouter button triggers a LiveAction? It does seem like the action might be triggering before the Nom model updates... but I'm not sure.

2) Can you post a bit more of the code? I'm interested in the Twig template for the Nom field and + Ajouter button. I'm also interested in the related PHP code for both of these (any relevant LiveProp and LiveAction). Oh, and I see now that you're using a CollectionType form, so that is definitely relevant too.

If you're able to create small reproducer, that would be the BEST.

Cheers!

alexgaill commented 1 year ago

Hi released version 2.7 resolve this issue. Do you still want some code to understand it?