Skip to content

Commit 539e3cb

Browse files
TheDutchScorpionweaverryan
authored andcommitted
Add ResetInterface to LiveComponentMetadataFactory
1 parent 373deed commit 539e3cb

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/DependencyInjection/LiveComponentExtension.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ function (ChildDefinition $definition, AsLiveComponent $attribute) {
184184
new Reference('ux.twig_component.component_factory'),
185185
new Reference('property_info'),
186186
])
187+
->addTag('kernel.reset', ['method' => 'reset'])
187188
;
188189

189190
$container->register(ComponentValidator::class)

src/Metadata/LiveComponentMetadataFactory.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface;
1515
use Symfony\Component\PropertyInfo\Type;
16+
use Symfony\Contracts\Service\ResetInterface;
1617
use Symfony\UX\LiveComponent\Attribute\LiveProp;
1718
use Symfony\UX\TwigComponent\ComponentFactory;
1819

@@ -23,7 +24,7 @@
2324
*
2425
* @internal
2526
*/
26-
class LiveComponentMetadataFactory
27+
class LiveComponentMetadataFactory implements ResetInterface
2728
{
2829
/** @var LiveComponentMetadata[] */
2930
private array $liveComponentMetadata = [];
@@ -128,4 +129,9 @@ private static function propertiesFor(\ReflectionClass $class): iterable
128129
yield from self::propertiesFor($parent);
129130
}
130131
}
132+
133+
public function reset(): void
134+
{
135+
$this->liveComponentMetadata = [];
136+
}
131137
}

0 commit comments

Comments
 (0)