Skip to content

Commit

Permalink
Merge pull request #116 from ar-io/develop
Browse files Browse the repository at this point in the history
Release to production
  • Loading branch information
kunstmusik authored Nov 20, 2024
2 parents 128ce20 + 156732c commit b325ebe
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 11 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [1.4.2] - 2024-11-20

### Updated

* Show error message toast if the application is unable to retrieve the current epoch

## [1.4.1] - 2024-11-18

### Updated
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@ar-io/network-portal",
"private": true,
"version": "1.4.1",
"version": "1.4.2",
"type": "module",
"scripts": {
"build": "yarn clean && tsc --build tsconfig.build.json && NODE_OPTIONS=--max-old-space-size=32768 vite build",
Expand All @@ -20,7 +20,7 @@
"deploy": "yarn build && permaweb-deploy --ant-process ${DEPLOY_ANT_PROCESS_ID}"
},
"dependencies": {
"@ar.io/sdk": "2.5.0-alpha.3",
"@ar.io/sdk": "2.5.0-alpha.8",
"@fontsource/rubik": "^5.0.19",
"@headlessui/react": "^1.7.19",
"@radix-ui/react-tooltip": "^1.0.7",
Expand Down
28 changes: 23 additions & 5 deletions src/components/GlobalDataProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import { AO_CU_URL, log } from '@src/constants';
import { useEffectOnce } from '@src/hooks/useEffectOnce';
import { useGlobalState } from '@src/store';
import { cleanupDbCache } from '@src/store/db';
import { showErrorToast } from '@src/utils/toast';
import { ReactElement, useEffect } from 'react';

// Time to wait in ms to check if the AO CU URL is congested
const CONGESTION_WINDOW = 5000;
const TWO_MINUTES = 120000;

const GlobalDataProvider = ({ children }: { children: ReactElement }) => {

const setBlockHeight = useGlobalState((state) => state.setBlockHeight);
const setCurrentEpoch = useGlobalState((state) => state.setCurrentEpoch);
const setTicker = useGlobalState((state) => state.setTicker);
Expand All @@ -23,11 +23,29 @@ const GlobalDataProvider = ({ children }: { children: ReactElement }) => {
const { Ticker } = await arioReadSDK.getInfo();
setTicker(Ticker);

const currentEpoch = await arioReadSDK.getCurrentEpoch();
setCurrentEpoch(currentEpoch);
try {
const currentEpoch = await arioReadSDK.getCurrentEpoch();

// FIXME: This is here to prevent the app from crashing when the current epoch comes back as an empty array.
// This is due to how contract and SDK are currently handling the epoch data situation when it can't be fetched.
// This should be removed when the above situation is changed to throw an exception.
if (Array.isArray(currentEpoch)) {
log.error('Error fetching current epoch');
showErrorToast(
'Error fetching current epoch. Application may not function as expected.',
);
return;
}
setCurrentEpoch(currentEpoch);

if (currentEpoch?.epochIndex) {
cleanupDbCache(currentEpoch.epochIndex);
if (currentEpoch?.epochIndex) {
cleanupDbCache(currentEpoch.epochIndex);
}
} catch (error) {
log.error('Error fetching current epoch');
showErrorToast(
'Error fetching current epoch. Application may not function as expected.',
);
}
};

Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@
plimit-lit "^3.0.1"
warp-contracts "1.4.45"

"@ar.io/[email protected].3":
version "2.5.0-alpha.3"
resolved "https://registry.yarnpkg.com/@ar.io/sdk/-/sdk-2.5.0-alpha.3.tgz#f87847c1ad11b707a7943ba78c53e026578b6d38"
integrity sha512-Ht9psXowzRKLaqXki1STiD4qTy3qlNRgiiTfTJ0uNuRRswHxFIu7soUPmO06JJi/m9OA/gzeMrhdssO6kbMPhA==
"@ar.io/[email protected].8":
version "2.5.0-alpha.8"
resolved "https://registry.yarnpkg.com/@ar.io/sdk/-/sdk-2.5.0-alpha.8.tgz#7057896b7858122237c69f11a2bbaeb59ce811af"
integrity sha512-+cE/jsfgQEwHb7rUNLvU77Tmhien+y3O9xOR+sE5Agj+RBwJthrl3JxZjAyd3nMaJ6OweLtZWhmHqCI+RQRAAg==
dependencies:
"@dha-team/arbundles" "^1.0.1"
"@permaweb/aoconnect" "^0.0.57"
Expand Down

0 comments on commit b325ebe

Please sign in to comment.