Closed bertoost closed 4 years ago
FYI; Because for every icon in a set this line is executed; https://github.com/verbb/icon-picker/blob/craft-3/src/models/IconModel.php#L115 And after that; https://github.com/verbb/icon-picker/blob/craft-3/src/models/IconModel.php#L91 The IconSources service is initiated a lot of times. Luckily PHP remembers the object instance from memory, but when not keeping the already-loaded sources in the object, it will load over and over again. That's why storing it in a local variable is working.
Great thinking here, and thanks for the PR!
Fixes https://github.com/verbb/icon-picker/issues/34 And makes loading custom remote sources much faster