Allow storage without accounts (#4514)

This commit is contained in:
Jaco Greeff 2021-01-27 15:39:22 +01:00 committed by GitHub
parent d940f234ca
commit 960f0d6fc9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 3 deletions

View File

@ -10,7 +10,6 @@ export default function create (t: TFunction): Route {
return {
Component,
display: {
needsAccounts: true,
needsApi: []
},
group: 'developer',

View File

@ -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<Props, State> {
// 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 (
<Static
className={className}
help={help}
label={label}
>
No accounts are available for selection.
</Static>
);
}
const { lastValue, value } = this.state;
@ -240,7 +251,7 @@ class InputAddress extends React.PureComponent<Props, State> {
onChangeMulti(
addresses
.map(transformToAccountId)
.filter((address): string => address as string) as string[]
.filter((address) => address as string) as string[]
);
}
}