Skip to content

Commit

Permalink
feat: automatically refresh cache on sets / icons change
Browse files Browse the repository at this point in the history
  • Loading branch information
lukas-frey committed Feb 16, 2024
2 parents b032aef + 2a3a4a7 commit db899b4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Forms/IconPicker.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,11 @@ public function multiple(bool|Closure $condition = true): static

private function loadIcons(): Collection
{
$iconsHash = md5(serialize($this->getSets()));
$key = "icon-picker.fields.{$iconsHash}.{$this->getStatePath()}";

[$sets, $allowedIcons, $disallowedIcons] = $this->tryCache(
"icon-picker.fields.{$this->getStatePath()}",
$key,
function () {
$allowedIcons = $this->getAllowedIcons();
$disallowedIcons = $this->getDisallowedIcons();
Expand Down

0 comments on commit db899b4

Please sign in to comment.