Skip to content

[LiveComponent] Test helper doesn't work with localized components #1565

Closed
@javiereguiluz

Description

@javiereguiluz

If your live components are localized as explained in https://symfony.com/bundles/ux-live-component/current/index.html#installation:

# config/routes/ux_live_component.yaml
live_component:
    resource: '@LiveComponentBundle/config/routes.php'
    prefix: /{_locale}/_components

You can't use the test helper (https://symfony.com/bundles/ux-live-component/current/index.html#test-helper) because you'll see this error:

Symfony\Component\Routing\Exception\MissingMandatoryParametersException:
Some mandatory parameters are missing ("_locale") to generate a URL for route "ux_live_component".

The arguments used to generate the URL seem hardcoded, so I don't know how to solve this:

$this->router->generate(
$this->metadata->get('route'),
array_filter([
'_live_component' => $this->metadata->getName(),
'_live_action' => $action,
])
),

Thanks!

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions