Skip to content

Commit 41889f4

Browse files
committed
Add live-id to any component
Embedded components can also be live now, so they also need a live-id.
1 parent 2b38f1f commit 41889f4

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/LiveComponent/src/Util/LiveControllerAttributesCreator.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -87,16 +87,16 @@ public function attributesForRendering(MountedComponent $mounted, ComponentMetad
8787
]);
8888
}
8989

90-
if ($isChildComponent) {
91-
if (!isset($mountedAttributes->all()['data-live-id'])) {
92-
$id = $deterministicId ?: $this->idCalculator
93-
->calculateDeterministicId(key: $mounted->getInputProps()[self::KEY_PROP_NAME] ?? null);
94-
$attributesCollection->setLiveId($id);
95-
// we need to add this to the mounted attributes so that it is
96-
// will be included in the "attributes" part of the props data.
97-
$mountedAttributes = $mountedAttributes->defaults(['data-live-id' => $id]);
98-
}
90+
if (!isset($mountedAttributes->all()['data-live-id'])) {
91+
$id = $deterministicId ?: $this->idCalculator
92+
->calculateDeterministicId(key: $mounted->getInputProps()[self::KEY_PROP_NAME] ?? null);
93+
$attributesCollection->setLiveId($id);
94+
// we need to add this to the mounted attributes so that it is
95+
// will be included in the "attributes" part of the props data.
96+
$mountedAttributes = $mountedAttributes->defaults(['data-live-id' => $id]);
97+
}
9998

99+
if ($isChildComponent) {
100100
$fingerprint = $this->fingerprintCalculator->calculateFingerprint(
101101
$mounted->getInputProps(),
102102
$this->metadataFactory->getMetadata($mounted->getName())

0 commit comments

Comments
 (0)