From 433c06690a8a7e87f9b731d41ae412b813b0f394 Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Wed, 19 Feb 2020 17:15:57 +0100 Subject: [PATCH] Remove upgrade overlay (API with runtime upgrade support) (#2291) * Remove upgrade overlay (API with runtime upgrade support) * Bump deps --- package.json | 6 +- packages/app-contracts/package.json | 2 +- packages/apps/src/Apps.tsx | 2 - packages/apps/src/overlays/Upgrade.tsx | 68 ---------------- packages/react-api/package.json | 2 +- yarn.lock | 108 ++++++++++++------------- 6 files changed, 59 insertions(+), 129 deletions(-) delete mode 100644 packages/apps/src/overlays/Upgrade.tsx diff --git a/package.json b/package.json index 7ff5dc7753..294fada59a 100644 --- a/package.json +++ b/package.json @@ -10,10 +10,10 @@ "packages/*" ], "resolutions": { - "@polkadot/api": "^1.4.0-beta.7", - "@polkadot/api-contract": "^1.4.0-beta.7", + "@polkadot/api": "^1.4.0-beta.9", + "@polkadot/api-contract": "^1.4.0-beta.9", "@polkadot/keyring": "^2.4.1", - "@polkadot/types": "^1.4.0-beta.7", + "@polkadot/types": "^1.4.0-beta.9", "@polkadot/util": "^2.4.1", "@polkadot/util-crypto": "^2.4.1", "babel-core": "^7.0.0-bridge.0", diff --git a/packages/app-contracts/package.json b/packages/app-contracts/package.json index 12eaa2b18c..c04a2d67bb 100644 --- a/packages/app-contracts/package.json +++ b/packages/app-contracts/package.json @@ -12,6 +12,6 @@ "license": "Apache-2.0", "dependencies": { "@babel/runtime": "^7.8.4", - "@polkadot/api-contract": "^1.4.0-beta.7" + "@polkadot/api-contract": "^1.4.0-beta.9" } } diff --git a/packages/apps/src/Apps.tsx b/packages/apps/src/Apps.tsx index c5a4b8f645..c90e0c595f 100644 --- a/packages/apps/src/Apps.tsx +++ b/packages/apps/src/Apps.tsx @@ -13,7 +13,6 @@ import Signer from '@polkadot/react-signer'; import AccountsOverlay from './overlays/Accounts'; import ConnectingOverlay from './overlays/Connecting'; -import UpgradeOverlay from './overlays/Upgrade'; import { SideBarTransition, SIDEBAR_MENU_THRESHOLD } from './constants'; import Content from './Content'; import SideBar from './SideBar'; @@ -90,7 +89,6 @@ function Apps ({ className }: Props): React.ReactElement { - diff --git a/packages/apps/src/overlays/Upgrade.tsx b/packages/apps/src/overlays/Upgrade.tsx deleted file mode 100644 index 681a7bf3ea..0000000000 --- a/packages/apps/src/overlays/Upgrade.tsx +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2017-2020 @polkadot/apps authors & contributors -// This software may be modified and distributed under the terms -// of the Apache-2.0 license. See the LICENSE file for details. - -import { RuntimeVersion } from '@polkadot/types/interfaces'; - -import React, { useEffect, useState } from 'react'; -import { Button } from '@polkadot/react-components'; -import { useApi, useCall } from '@polkadot/react-hooks'; - -import { useTranslation } from '../translate'; -import BaseOverlay from './Base'; - -interface Props { - className?: string; -} - -let lastVersion = -1; - -export default function Upgrade ({ className }: Props): React.ReactElement | null { - const { t } = useTranslation(); - const { api, isApiReady, isApiConnected } = useApi(); - const runtimeVersion = useCall(api.rpc.state.subscribeRuntimeVersion, []); - const [hasUpgraded, setHasUpgraded] = useState(false); - - useEffect((): void => { - if (!hasUpgraded && runtimeVersion) { - const version = runtimeVersion.specVersion.toNumber(); - - if (lastVersion === -1) { - lastVersion = version; - } - - const newStatus = lastVersion !== version; - - if (newStatus !== hasUpgraded) { - setHasUpgraded(newStatus); - } - - lastVersion = version; - } - }, [hasUpgraded, runtimeVersion]); - - if (!isApiReady || !isApiConnected || !hasUpgraded || !runtimeVersion) { - return null; - } - - const _onReload = (): void => { - window.location.reload(); - }; - - return ( - -

{t(`The runtime has been upgraded to ${runtimeVersion.specVersion.toNumber()}, your current interface would need to be refreshed to take advantage of the new features.`)}

-

-