File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
src/Infinityloop/LazyComponent Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change 6
6
7
7
abstract class LazyComponent extends \Nette \Application \UI \Control
8
8
{
9
+ protected const EMPTY_TEMPLATE = __DIR__ . '/emptyTemplate.latte ' ;
10
+
9
11
private bool $ loaded = false ;
10
12
11
13
public function handleLoadComponent () : void
@@ -23,6 +25,7 @@ public function render() : void
23
25
{
24
26
$ this ->template ->setFile (__DIR__ . '/LazyComponent.latte ' );
25
27
$ this ->template ->loaded = $ this ->loaded ;
28
+ $ this ->template ->emptyTemplate = static ::EMPTY_TEMPLATE ;
26
29
27
30
if ($ this ->loaded ) {
28
31
$ this ->beforeRender ();
@@ -50,7 +53,7 @@ public function saveState(array &$params): void
50
53
public function loadState (array $ params ): void
51
54
{
52
55
parent ::loadState ($ params );
53
- $ this ->loaded = (bool ) ($ params ['lazyComponent_loaded ' ] ?? $ this -loaded);
56
+ $ this ->loaded = (bool ) ($ params ['lazyComponent_loaded ' ] ?? $ this -> loaded );
54
57
}
55
58
56
59
protected function beforeRender () : void
You can’t perform that action at this time.
0 commit comments