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 66
77abstract class LazyComponent extends \Nette \Application \UI \Control
88{
9+ protected const EMPTY_TEMPLATE = __DIR__ . '/emptyTemplate.latte ' ;
10+
911 private bool $ loaded = false ;
1012
1113 public function handleLoadComponent () : void
@@ -23,6 +25,7 @@ public function render() : void
2325 {
2426 $ this ->template ->setFile (__DIR__ . '/LazyComponent.latte ' );
2527 $ this ->template ->loaded = $ this ->loaded ;
28+ $ this ->template ->emptyTemplate = static ::EMPTY_TEMPLATE ;
2629
2730 if ($ this ->loaded ) {
2831 $ this ->beforeRender ();
@@ -50,7 +53,7 @@ public function saveState(array &$params): void
5053 public function loadState (array $ params ): void
5154 {
5255 parent ::loadState ($ params );
53- $ this ->loaded = (bool ) ($ params ['lazyComponent_loaded ' ] ?? $ this -loaded);
56+ $ this ->loaded = (bool ) ($ params ['lazyComponent_loaded ' ] ?? $ this -> loaded );
5457 }
5558
5659 protected function beforeRender () : void
You can’t perform that action at this time.
0 commit comments