File tree Expand file tree Collapse file tree 2 files changed +15
-6
lines changed Expand file tree Collapse file tree 2 files changed +15
-6
lines changed Original file line number Diff line number Diff line change 5151 * to directly select them
5252 */
5353 'options ' => function (array $ options = []): array {
54+ // make sure to flush the options cache when
55+ // new options are being passed
56+ $ this ->optionsCache = null ;
5457 return $ options ;
5558 }
5659 ],
5962 return Str::lower ($ this ->default );
6063 },
6164 'options ' => function (): array {
65+ return $ this ->optionsCache ??= $ this ->getOptions ();
66+ }
67+ ],
68+ 'methods ' => [
69+ 'emptyValue ' => function () {
70+ return '' ;
71+ },
72+ 'getOptions ' => function () {
6273 // resolve options to support manual arrays
6374 // alongside api and query options
6475 $ props = FieldOptions::polyfill ($ this ->props );
103114 }
104115
105116 return $ options ;
106- }
107- ],
108- 'methods ' => [
109- 'emptyValue ' => function () {
110- return '' ;
111117 },
112118 'isColor ' => function (string $ value ): bool {
113119 return
Original file line number Diff line number Diff line change 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 /**
2528 ],
2629 'computed ' => [
2730 'options ' => function (): array {
28- return $ this ->getOptions ();
31+ return $ this ->optionsCache ??= $ this -> getOptions ();
2932 }
3033 ],
3134 'methods ' => [
You can’t perform that action at this time.
0 commit comments