fix id calc

This commit is contained in:
tophf 2021-04-18 15:24:19 +03:00
parent 623005e068
commit 000a614933

View File

@ -143,7 +143,7 @@
window.on('styleAdded', async ({detail: {style}}) => { window.on('styleAdded', async ({detail: {style}}) => {
restoreScrollPosition(); restoreScrollPosition();
const id = calcId(style) || calcId(await API.styles.get(style.id)); const id = calcId(style) || calcId(await API.styles.get(style.id));
if (id && results.find(r => r.id === id)) { if (id && results.find(r => r.i === id)) {
renderActionButtons(id, style.id); renderActionButtons(id, style.id);
} }
}); });
@ -188,7 +188,7 @@
} }
if (results.length) { if (results.length) {
const installedStyles = await API.styles.getAll(); const installedStyles = await API.styles.getAll();
const allSupportedIds = new Set(installedStyles.map(calcUsoId || calcUswId)); const allSupportedIds = new Set(installedStyles.map(calcId));
results = results.filter(r => !allSupportedIds.has(r.i)); results = results.filter(r => !allSupportedIds.has(r.i));
} }
render(); render();
@ -543,8 +543,8 @@
URLS.extractUsoArchiveId(updateUrl); URLS.extractUsoArchiveId(updateUrl);
} }
function calcUswId({installationUrl}) { function calcUswId({updateUrl}) {
return URLS.extractUSwId(installationUrl) || 0; return URLS.extractUSwId(updateUrl) || 0;
} }
function calcId(style) { function calcId(style) {