mercure-bundle icon indicating copy to clipboard operation
mercure-bundle copied to clipboard

How can we update the `TurboStreamListenerRenderer` configuration?

Open Fan2Shrek opened this issue 9 months ago • 4 comments

While working on symfony/ux#2447 @smnandre and I saw that the TurboStreamListenRenderer service is configured in this line. Today, we need to change the configuration. How can we handle this?

See https://github.com/symfony/ux/pull/2447#discussion_r1968371625

Fan2Shrek avatar Feb 27 '25 07:02 Fan2Shrek

I don't remember why this registration has been done here, but I also agree that it should be done in Symfony UX.

Maybe could we register it in your PR and update the code here to register it only if it doesn't exist for BC?

dunglas avatar Feb 27 '25 10:02 dunglas

Stupid question, but isn't this related to the fact that TurboStreamListenRenderer and Broadcaster are per hub?

If so, what should be done?

Fan2Shrek avatar Feb 27 '25 18:02 Fan2Shrek

This should be possible to register them per hub in a compiler pass executing after the Mercure bundle.

dunglas avatar Feb 28 '25 11:02 dunglas

i just ran into this. the only workaround i found was to lock symfony/ux-turbo at 2.23.*, otherwise i get an exception from the container:

Too few arguments to function Symfony\UX\Turbo\Bridge\Mercure\TurboStreamListenRenderer::__construct(), 3 passed in /app/var/cache/test/ContainerKApx7ly/getTurbo_Mercure_Default_RendererService.php on line 31 and exactly 4 expected

are there any plans to solve the problem?

dbu avatar Aug 04 '25 13:08 dbu