From 960f0d6fc96d636c777e7952ce5c8fdb1822fae3 Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Wed, 27 Jan 2021 15:39:22 +0100 Subject: [PATCH] Allow storage without accounts (#4514) --- packages/apps-routing/src/storage.ts | 1 - .../react-components/src/InputAddress/index.tsx | 15 +++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/packages/apps-routing/src/storage.ts b/packages/apps-routing/src/storage.ts index c1a8785fa5..4e50747e07 100644 --- a/packages/apps-routing/src/storage.ts +++ b/packages/apps-routing/src/storage.ts @@ -10,7 +10,6 @@ export default function create (t: TFunction): Route { return { Component, display: { - needsAccounts: true, needsApi: [] }, group: 'developer', diff --git a/packages/react-components/src/InputAddress/index.tsx b/packages/react-components/src/InputAddress/index.tsx index d0600c72c0..0d2f31fd38 100644 --- a/packages/react-components/src/InputAddress/index.tsx +++ b/packages/react-components/src/InputAddress/index.tsx @@ -14,6 +14,7 @@ import { createOptionItem } from '@polkadot/ui-keyring/options/item'; import { isNull, isUndefined } from '@polkadot/util'; import Dropdown from '../Dropdown'; +import Static from '../Static'; import { getAddressName } from '../util'; import addressToAddress from '../util/toAddress'; import createHeader from './createHeader'; @@ -138,7 +139,17 @@ class InputAddress extends React.PureComponent { // the options could be delayed, don't render without if (!hasOptions && !isDisabled) { - return null; + // This is nasty, but since this things is non-functional, there is not much + // we can do (well, wrap it, however that approach is deprecated here) + return ( + + No accounts are available for selection. + + ); } const { lastValue, value } = this.state; @@ -240,7 +251,7 @@ class InputAddress extends React.PureComponent { onChangeMulti( addresses .map(transformToAccountId) - .filter((address): string => address as string) as string[] + .filter((address) => address as string) as string[] ); } }