Improve page load times

This commit is contained in:
rxdn 2022-06-04 22:43:05 +01:00
parent 4b32ac1f96
commit 042a25f90a
8 changed files with 47 additions and 38 deletions

View File

@ -119,8 +119,8 @@
} }
} }
withLoadingScreen(async () => { withLoadingScreen(async () => await Promise.all([
await loadPremium(); loadPremium(),
await loadSettings(); loadSettings()
}); ]));
</script> </script>

View File

@ -227,9 +227,12 @@
} }
withLoadingScreen(async () => { withLoadingScreen(async () => {
await loadPanels(); await Promise.all([
await loadChannels(); loadPanels(),
await loadData(); loadChannels()
]);
await loadData(); // Depends on channels
}); });
</script> </script>

View File

@ -82,9 +82,12 @@
} }
withLoadingScreen(async () => { withLoadingScreen(async () => {
setDefaultHeaders(); setDefaultHeaders(); // TODO: Is this needed?
await loadPremium();
await loadColours(); await Promise.all([
loadPremium(),
loadColours()
]);
}); });
</script> </script>

View File

@ -332,14 +332,16 @@
} }
withLoadingScreen(async () => { withLoadingScreen(async () => {
await loadPremium(); await Promise.all([
await loadChannels(); loadPremium(),
await loadTeams(); loadChannels(),
await loadForms(); loadTeams(),
await loadRoles(); loadForms(),
await loadPanels(); loadRoles(),
await loadMultiPanels(); loadPanels(),
}) loadMultiPanels()
]);
});
</script> </script>
<style> <style>

View File

@ -229,9 +229,13 @@
withLoadingScreen(async () => { withLoadingScreen(async () => {
setDefaultHeaders(); setDefaultHeaders();
await loadTeams();
await loadRoles(); await Promise.all([
await updateActiveTeam(); loadTeams(),
loadRoles()
]);
await updateActiveTeam(); // Depends on teams
}); });
</script> </script>

View File

@ -126,8 +126,10 @@
withLoadingScreen(async () => { withLoadingScreen(async () => {
setDefaultHeaders(); setDefaultHeaders();
await loadPremium(); await Promise.all([
await loadMessages(); loadPremium(),
loadMessages()
]);
scrollContainer(); scrollContainer();

View File

@ -204,14 +204,6 @@
panels = res.data; panels = res.data;
} }
async function loadSettings() {
const res = await axios.get(`${API_URL}/api/${guildId}/settings`);
if (res.status !== 200) {
notifyError(res.data.error);
return;
}
}
async function loadData(paginationSettings) { async function loadData(paginationSettings) {
const res = await axios.post(`${API_URL}/api/${guildId}/transcripts`, paginationSettings); const res = await axios.post(`${API_URL}/api/${guildId}/transcripts`, paginationSettings);
if (res.status !== 200) { if (res.status !== 200) {
@ -224,9 +216,10 @@
} }
withLoadingScreen(async () => { withLoadingScreen(async () => {
await loadPanels(); await Promise.all([
await loadSettings(); loadPanels(),
await loadData({}) loadData({})
])
}) })
</script> </script>

View File

@ -338,9 +338,11 @@
withLoadingScreen(async () => { withLoadingScreen(async () => {
if (await loadBot()) { if (await loadBot()) {
await loadErrors(); await Promise.all([
await loadInteractionUrl(); loadErrors(),
await loadPublicKey(); loadInteractionUrl(),
loadPublicKey()
]);
} }
}); });
</script> </script>