From 8ac6364d3a84910a4c70fc938667a4914fe5fb14 Mon Sep 17 00:00:00 2001 From: Rishabh Date: Mon, 24 May 2021 18:10:48 +0530 Subject: [PATCH] Updated site and member data to load in parallel no refs Previously, the site and member data needed by Portal were loaded sequentially, which delayed the first load slightly as both the requests can be instead made in parallel. This change updates the API init to load both requests in parallel. --- ghost/portal/src/utils/api.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ghost/portal/src/utils/api.js b/ghost/portal/src/utils/api.js index 7bc49ce77e..24b28f1b85 100644 --- a/ghost/portal/src/utils/api.js +++ b/ghost/portal/src/utils/api.js @@ -244,8 +244,10 @@ function setupGhostApi({siteUrl = window.location.origin}) { }; api.init = async () => { - const {site} = await api.site.read(); - const member = await api.member.sessionData(); + const [{site}, member] = await Promise.all([ + api.site.read(), + api.member.sessionData() + ]); return {site, member}; };