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 () => {
await loadPremium();
await loadSettings();
});
withLoadingScreen(async () => await Promise.all([
loadPremium(),
loadSettings()
]));
</script>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -204,14 +204,6 @@
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) {
const res = await axios.post(`${API_URL}/api/${guildId}/transcripts`, paginationSettings);
if (res.status !== 200) {
@ -224,9 +216,10 @@
}
withLoadingScreen(async () => {
await loadPanels();
await loadSettings();
await loadData({})
await Promise.all([
loadPanels(),
loadData({})
])
})
</script>

View File

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