2
0
mirror of https://github.com/iconify/iconify.git synced 2024-11-09 23:00:56 +00:00

Do not store empty icon sets in browser storage, remove not_found property

This commit is contained in:
Vjacheslav Trushkin 2022-02-02 09:56:56 +02:00
parent ded43ed8fc
commit a76aafa447

View File

@ -308,6 +308,17 @@ export const storeCache: CacheIcons = (
return true;
}
// Do not store empty sets
if (!Object.keys(data.icons).length) {
return;
}
// Remove not_found (clone object to keep old object intact)
if (data.not_found) {
data = Object.assign({}, data);
delete data.not_found;
}
// Attempt to store at localStorage first, then at sessionStorage
if (!store('local')) {
store('session');