Skip to content

Commit

Permalink
Add kernel reset
Browse files Browse the repository at this point in the history
  • Loading branch information
smnandre committed Nov 11, 2024
1 parent 78303c2 commit d4092c2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/TwigComponent/src/ComponentRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
namespace Symfony\UX\TwigComponent;

use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
use Symfony\Contracts\Service\ResetInterface;
use Symfony\UX\TwigComponent\Event\PostRenderEvent;
use Symfony\UX\TwigComponent\Event\PreCreateForRenderEvent;
use Symfony\UX\TwigComponent\Event\PreRenderEvent;
Expand All @@ -22,7 +23,7 @@
*
* @internal
*/
final class ComponentRenderer implements ComponentRendererInterface
final class ComponentRenderer implements ComponentRendererInterface, ResetInterface
{
private array $templateClasses = [];

Expand Down Expand Up @@ -139,4 +140,9 @@ private function preRender(MountedComponent $mounted, array $context = []): PreR

return $event;
}

public function reset(): void
{
$this->templateClasses = [];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ static function (ChildDefinition $definition, AsTwigComponent $attribute) {
new Reference('ux.twig_component.component_properties'),
new Reference('ux.twig_component.component_stack'),
])
->addTag('kernel.reset', ['method' => 'reset'])
;

$container->register('ux.twig_component.twig.component_extension', ComponentExtension::class)
Expand Down

0 comments on commit d4092c2

Please sign in to comment.