Skip to content

Commit d4092c2

Browse files
committed
Add kernel reset
1 parent 78303c2 commit d4092c2

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/TwigComponent/src/ComponentRenderer.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\UX\TwigComponent;
1313

1414
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
15+
use Symfony\Contracts\Service\ResetInterface;
1516
use Symfony\UX\TwigComponent\Event\PostRenderEvent;
1617
use Symfony\UX\TwigComponent\Event\PreCreateForRenderEvent;
1718
use Symfony\UX\TwigComponent\Event\PreRenderEvent;
@@ -22,7 +23,7 @@
2223
*
2324
* @internal
2425
*/
25-
final class ComponentRenderer implements ComponentRendererInterface
26+
final class ComponentRenderer implements ComponentRendererInterface, ResetInterface
2627
{
2728
private array $templateClasses = [];
2829

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

140141
return $event;
141142
}
143+
144+
public function reset(): void
145+
{
146+
$this->templateClasses = [];
147+
}
142148
}

src/TwigComponent/src/DependencyInjection/TwigComponentExtension.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ static function (ChildDefinition $definition, AsTwigComponent $attribute) {
113113
new Reference('ux.twig_component.component_properties'),
114114
new Reference('ux.twig_component.component_stack'),
115115
])
116+
->addTag('kernel.reset', ['method' => 'reset'])
116117
;
117118

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

0 commit comments

Comments
 (0)