Skip to content

Commit

Permalink
Update isLoadingAssets after a failure to fetch asset data (#5082)
Browse files Browse the repository at this point in the history
  • Loading branch information
jinchung authored Sep 29, 2023
1 parent 3a8b36b commit bca9b45
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/redux/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export const DATA_LOAD_ACCOUNT_ASSETS_DATA_REQUEST =
'data/DATA_LOAD_ACCOUNT_ASSETS_DATA_REQUEST';
export const DATA_LOAD_ACCOUNT_ASSETS_DATA_SUCCESS =
'data/DATA_LOAD_ACCOUNT_ASSETS_DATA_SUCCESS';
const DATA_LOAD_ACCOUNT_ASSETS_DATA_FAILURE =
export const DATA_LOAD_ACCOUNT_ASSETS_DATA_FAILURE =
'data/DATA_LOAD_ACCOUNT_ASSETS_DATA_FAILURE';

const DATA_LOAD_TRANSACTIONS_REQUEST = 'data/DATA_LOAD_TRANSACTIONS_REQUEST';
Expand Down
8 changes: 7 additions & 1 deletion src/resources/assets/UserAssetsQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ import {
QueryFunctionArgs,
QueryFunctionResult,
} from '@/react-query';
import { DATA_LOAD_ACCOUNT_ASSETS_DATA_SUCCESS } from '@/redux/data';
import {
DATA_LOAD_ACCOUNT_ASSETS_DATA_FAILURE,
DATA_LOAD_ACCOUNT_ASSETS_DATA_SUCCESS,
} from '@/redux/data';
import store from '@/redux/store';
import { useQuery } from '@tanstack/react-query';
import {
Expand Down Expand Up @@ -144,6 +147,9 @@ async function userAssetsQueryFunction({

return parsedSuccessResults;
} catch (e) {
dispatch({
type: DATA_LOAD_ACCOUNT_ASSETS_DATA_FAILURE,
});
return cachedAddressAssets;
}
}
Expand Down

0 comments on commit bca9b45

Please sign in to comment.