File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -73,6 +73,16 @@ public function onPreRender(PreRenderEvent $event): void
7373 $ originalAttributes ['data-embedded-template-index ' ],
7474 );
7575 }
76+
77+ $ hasLiveId = isset ($ originalAttributes ['data-live-id ' ]);
78+ $ isDeferred = array_key_exists ('defer ' , $ originalAttributes );
79+
80+ // if the original attributes has a data-live-id, it means the component
81+ // was already rendered
82+ if (!$ hasLiveId && $ isDeferred ) {
83+ $ attributes = $ attributes ->without ('defer ' );
84+ $ event ->setTemplate ('@LiveComponent/deferred.html.twig ' );
85+ }
7686 }
7787
7888 // "key" is a special attribute: don't actually render it
Original file line number Diff line number Diff line change 1+ <div {{ attributes }} data-action =" live:connect->live#$render" ></div >
You can’t perform that action at this time.
0 commit comments