tobimori / kirby-icon-field

🏷️ A simple Icon field plugin for Kirby CMS.
https://getkirby.com/plugins/tobimori/icon-field
MIT License
38 stars 4 forks source link

Caching: limit hashing to actually used parameters #16

Closed adamkiss closed 6 months ago

adamkiss commented 6 months ago

You've used all props to create the hash under which options are cached. These props also include value, which makes the field very slow for larger iconsets, most notably when saving (value changed with save -> Kirby requests new field -> cache is worthless).

By pulling only the values which are used in the cached options (folder, sprite, include, exclude), cached options now can be used regardless of other field settings that don't change what options are available.

For large(r) iconsets, the change is: from 2-4 seconds on save, now we're back at ~150ms (eyeballed over 20+ requests, no real benchmarks)