File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change 25
25
*/
26
26
class LiveComponentMetadataFactory
27
27
{
28
+ /** @var LiveComponentMetadata[] */
29
+ private array $ liveComponentMetadata = [];
30
+
28
31
public function __construct (
29
32
private ComponentFactory $ componentFactory ,
30
33
private PropertyTypeExtractorInterface $ propertyTypeExtractor ,
@@ -33,12 +36,16 @@ public function __construct(
33
36
34
37
public function getMetadata (string $ name ): LiveComponentMetadata
35
38
{
39
+ if (isset ($ this ->liveComponentMetadata [$ name ])) {
40
+ return $ this ->liveComponentMetadata [$ name ];
41
+ }
42
+
36
43
$ componentMetadata = $ this ->componentFactory ->metadataFor ($ name );
37
44
38
45
$ reflectionClass = new \ReflectionClass ($ componentMetadata ->getClass ());
39
46
$ livePropsMetadata = $ this ->createPropMetadatas ($ reflectionClass );
40
47
41
- return new LiveComponentMetadata ($ componentMetadata , $ livePropsMetadata );
48
+ return $ this -> liveComponentMetadata [ $ name ] = new LiveComponentMetadata ($ componentMetadata , $ livePropsMetadata );
42
49
}
43
50
44
51
/**
You can’t perform that action at this time.
0 commit comments