From 89db7a22f678b4c74eb209f4777bb0aa00a6505b Mon Sep 17 00:00:00 2001 From: Abdelrhman Farag <85403429+aomafarag@users.noreply.github.com> Date: Mon, 12 Dec 2022 12:08:22 +0100 Subject: [PATCH] fix: Initial fetching/loading state (#563) --- frontend/store/auctions.ts | 3 ++- frontend/store/debt.ts | 2 +- frontend/store/surplus.ts | 2 +- frontend/store/vaults.ts | 5 ++++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/frontend/store/auctions.ts b/frontend/store/auctions.ts index 4cd7be806..e87e3ad06 100644 --- a/frontend/store/auctions.ts +++ b/frontend/store/auctions.ts @@ -40,7 +40,7 @@ interface State { const getInitialState = (): State => ({ auctionStorage: {}, takeEventStorage: {}, - areAuctionsFetching: false, + areAuctionsFetching: true, isSelectedAuctionFetching: false, areTakeEventsFetching: false, isBidding: false, @@ -214,6 +214,7 @@ export const actions = { return; } commit('setIsSelectedAuctionFetching', true); + commit('setAreAuctionsFetching', false); try { const auction = await fetchSingleAuctionById(network, auctionId); commit('setAuction', auction); diff --git a/frontend/store/debt.ts b/frontend/store/debt.ts index ab472438a..be6656754 100644 --- a/frontend/store/debt.ts +++ b/frontend/store/debt.ts @@ -30,7 +30,7 @@ interface State { const getInitialState = (): State => ({ auctionStorage: {}, auctionStates: {}, - areAuctionsFetching: false, + areAuctionsFetching: true, isAuthorizationLoading: false, error: null, lastUpdated: undefined, diff --git a/frontend/store/surplus.ts b/frontend/store/surplus.ts index b70c832b2..cbdeda6c8 100644 --- a/frontend/store/surplus.ts +++ b/frontend/store/surplus.ts @@ -46,7 +46,7 @@ const getInitialState = (): State => ({ auctionStorage: {}, auctionStates: {}, allowanceAmount: undefined, - areAuctionsFetching: false, + areAuctionsFetching: true, isAuthorizationLoading: false, error: null, lastUpdated: undefined, diff --git a/frontend/store/vaults.ts b/frontend/store/vaults.ts index 492895dd2..b2db7daaf 100644 --- a/frontend/store/vaults.ts +++ b/frontend/store/vaults.ts @@ -19,7 +19,7 @@ interface State { const getInitialState = (): State => ({ vaultTransactions: {}, vaultErrors: {}, - areVaultsLoading: false, + areVaultsLoading: true, isVaultBeingLiquidated: false, isVaultLiquidationDone: false, lastUpdated: undefined, @@ -88,6 +88,9 @@ export const actions = { }, async fetchVault({ commit, rootGetters }: ActionContext, vaultId: number) { const network = rootGetters['network/getMakerNetwork']; + if (!network) { + return; + } commit('setAreVaultsLoading', true); try { const vault = await fetchVault(network, vaultId);