Skip to content

Commit

Permalink
Merge pull request #7663 from kenjis/fix-view-cell-caching
Browse files Browse the repository at this point in the history
fix: [ViewCells] caching
  • Loading branch information
kenjis authored Jul 6, 2023
2 parents e1c3739 + f61b41d commit 1a83ef4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions system/View/Cell.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ public function __construct(CacheInterface $cache)
/**
* Render a cell, returning its body as a string.
*
* @param array|string|null $params
* @param string $library Cell class and method name.
* @param array|string|null $params Parameters to pass to the method.
* @param int $ttl Number of seconds to cache the cell.
* @param string|null $cacheName Cache item name.
*
* @throws ReflectionException
*/
Expand All @@ -76,6 +79,8 @@ public function render(string $library, $params = null, int $ttl = 0, ?string $c
? get_class($instance)
: null;

$params = $this->prepareParams($params);

// Is the output cached?
$cacheName = ! empty($cacheName)
? $cacheName
Expand All @@ -93,8 +98,6 @@ public function render(string $library, $params = null, int $ttl = 0, ?string $c
throw ViewException::forInvalidCellMethod($class, $method);
}

$params = $this->prepareParams($params);

$output = $instance instanceof BaseCell
? $this->renderCell($instance, $method, $params)
: $this->renderSimpleClass($instance, $method, $params, $class);
Expand Down

0 comments on commit 1a83ef4

Please sign in to comment.