You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have 'choices' option in my DatalistType, but it's extending TextType which, as I guess, has no default values for placeholder, multiple and expanded options so they're missing in vars array.
Possible solutions:
I can rename option 'choices' to something different, but I still haven't found a better name :)
I can set default values for placeholder, multiple and expanded and assign them to vars inside buildView function in my DatalistType - that's my temporary workaround;
Maybe these recently added vars tests could be null-coalesced or array_key_exists-ed in ComponentWithFormTrait?
Thank you for your great work on the whole UX ecosystem!
The text was updated successfully, but these errors were encountered:
Hello,
recently after upgrading symfony/ux-live-components to 2.22.x I've encountered this exception:
An exception has been thrown during the rendering of a template ("Warning: Undefined array key "placeholder"").
Here's the reproducer: https://github.com/maciazek/symfony-ux-live-components-choices-reproducer
I have a custom DatalistType form field, which extends TextType to add HTML datalist into it. Inside DatalistType I'm using 'choices' option to add choices to datalist.
https://github.com/maciazek/symfony-ux-live-components-choices-reproducer/blob/master/src/Form/DatalistType.php#L11-L29
https://github.com/maciazek/symfony-ux-live-components-choices-reproducer/blob/master/templates/form/custom_types.html.twig
I have a form inside live component which is using DatalistType as a child field.
https://github.com/maciazek/symfony-ux-live-components-choices-reproducer/blob/ebe9ff77a7181ed6e0ca4dd5fca7483f38e8ed94/src/Form/ExampleType.php#L9-L30
https://github.com/maciazek/symfony-ux-live-components-choices-reproducer/blob/ebe9ff77a7181ed6e0ca4dd5fca7483f38e8ed94/src/Twig/Components/ExampleForm.php#L13-L23
Everything worked well until updating symfony/ux-live-components to 2.22.x - then I've encountered previously mentioned error.
After some investigation I've found that problem is caused by recent change in ComponentWithFormTrait:
https://github.com/symfony/ux-live-component/blob/5adf780aac0ccbd5cb1dddea683db9aa99b91d4a/src/ComponentWithFormTrait.php#L264-L271
I have 'choices' option in my DatalistType, but it's extending TextType which, as I guess, has no default values for placeholder, multiple and expanded options so they're missing in vars array.
Possible solutions:
array_key_exists
-ed in ComponentWithFormTrait?Thank you for your great work on the whole UX ecosystem!
The text was updated successfully, but these errors were encountered: