Skip to content

Commit 6e8febf

Browse files
refact: Cache field options
1 parent 04ae3de commit 6e8febf

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

config/fields/mixins/options.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
* An array with options
1515
*/
1616
'options' => function ($options = []) {
17+
// make sure to flush the options cache when
18+
// new options are being passed
19+
$this->optionsCache = null;
1720
return $options;
1821
},
1922
/**
@@ -25,7 +28,7 @@
2528
],
2629
'computed' => [
2730
'options' => function (): array {
28-
return $this->getOptions();
31+
return $this->optionsCache ??= $this->getOptions();
2932
}
3033
],
3134
'methods' => [

0 commit comments

Comments
 (0)