From 34767e5ce37e524acbef3f7883a6e3f1b9ddd787 Mon Sep 17 00:00:00 2001 From: Wolfsblvt Date: Mon, 5 Aug 2024 02:05:27 +0200 Subject: [PATCH] Improve performance by half on WI book load --- public/scripts/world-info.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/public/scripts/world-info.js b/public/scripts/world-info.js index dc58a0f0b..6b1c87880 100644 --- a/public/scripts/world-info.js +++ b/public/scripts/world-info.js @@ -1867,7 +1867,8 @@ function displayWorldEntries(name, data, navigation = navigation_option.none, fl Trigger % `; - const blocks = page.map(entry => getWorldEntry(name, data, entry)).filter(x => x); + const blocksPromises = page.map(async (entry) => await getWorldEntry(name, data, entry)).filter(x => x); + const blocks = await Promise.all(blocksPromises); const isCustomOrder = $('#world_info_sort_order').find(':selected').data('rule') === 'custom'; if (!isCustomOrder) { blocks.forEach(block => { @@ -2251,7 +2252,7 @@ function parseRegexFromString(input) { } } -function getWorldEntry(name, data, entry) { +async function getWorldEntry(name, data, entry) { if (!data.entries[entry.uid]) { return; }