Skip to content

[Autocomplete/LiveComponent] How to re-render autocomplete after updating value with LiveListener #1622

Closed
@cyrille-osyla

Description

@cyrille-osyla

Hello,
I just set up the same system as this demo: https://ux.symfony.com/demos/live-component/product-form
This works very well for updating a classic select (EntityType) but not for a symfony UX autocomplete select type: https://ux.symfony.com/autocomplete
In the live component doc, it is stipulated to put the object id: https://symfony.com/bundles/ux-live-component/current/index.html#dynamically-updating-the-form-in-a-liveaction
live component form and listener:

#[AsLiveComponent]
class QuotationForm extends AbstractController
{
    use DefaultActionTrait;
    use LiveCollectionTrait;

    #[LiveProp(writable: true, fieldName: 'formData')]
    public Quotation $quotation;

    protected function instantiateForm(): FormInterface
    {
        return $this->createForm(QuotationType::class, $this->quotation);
    }

    #[LiveListener('customer:created')]
    public function onCustomerCreated(#[LiveArg] Customer $customer): void
    {
        $this->formValues['customer'] = $customer->getId();
    }
    
    //...

it updates the select which is hidden but not on the autocomplete overlay.
How can I refresh this from the listener?
Did I miss something?
Thank !

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