File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -76,12 +76,17 @@ public function onPreRender(PreRenderEvent $event): void
7676
7777 $ hasLiveId = isset ($ originalAttributes ['data-live-id ' ]);
7878 $ isDeferred = array_key_exists ('defer ' , $ originalAttributes );
79+ $ loadingTemplate = $ originalAttributes ['defer-loading-template ' ] ?? null ;
7980
8081 // if the original attributes has a data-live-id, it means the component
8182 // was already rendered
8283 if (!$ hasLiveId && $ isDeferred ) {
83- $ attributes = $ attributes ->without ('defer ' );
84+ $ attributes = $ attributes ->without ('defer ' , ' defer-loading-template ' );
8485 $ event ->setTemplate ('@LiveComponent/deferred.html.twig ' );
86+
87+ if ($ loadingTemplate ) {
88+ $ variables ['loadingTemplate ' ] = $ loadingTemplate ;
89+ }
8590 }
8691 }
8792
Original file line number Diff line number Diff line change 1- <div {{ attributes }} data-action =" live:connect->live#$render" ></div >
1+ <div {{ attributes }} data-action =" live:connect->live#$render" >
2+ {% if loadingTemplate is defined and loadingTemplate != null %}
3+ {{ include (loadingTemplate ) }}
4+ {% endif %}
5+ </div >
You can’t perform that action at this time.
0 commit comments