Fix map query iteration/non-iteration (#6165)
This commit is contained in:
parent
c5666d07f3
commit
e734ade40a
@ -104,9 +104,7 @@ function getCachedComponent (registry: Registry, query: QueryTypes): CacheInstan
|
||||
const { creator: { meta: { type } } } = key;
|
||||
const allCount = type.isPlain
|
||||
? 0
|
||||
: type.isMap
|
||||
? 1
|
||||
: 2;
|
||||
: type.asMap.hashers.length;
|
||||
|
||||
renderHelper = withCallDiv('subscribe', {
|
||||
paramName: 'params',
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
|
||||
import type { QueryableStorageEntry } from '@polkadot/api/types';
|
||||
import type { RawParams } from '@polkadot/react-params/types';
|
||||
import type { SiLookupTypeId, StorageEntryTypeLatest } from '@polkadot/types/interfaces';
|
||||
import type { StorageEntryTypeLatest } from '@polkadot/types/interfaces';
|
||||
import type { Registry, TypeDef } from '@polkadot/types/types';
|
||||
import type { ComponentProps as Props } from '../types';
|
||||
|
||||
@ -14,6 +14,7 @@ import { Button, InputStorage } from '@polkadot/react-components';
|
||||
import { useApi } from '@polkadot/react-hooks';
|
||||
import Params from '@polkadot/react-params';
|
||||
import { getTypeDef } from '@polkadot/types';
|
||||
import { getSiName } from '@polkadot/types/metadata/util';
|
||||
import { TypeDefInfo } from '@polkadot/types/types';
|
||||
import { isNull, isUndefined } from '@polkadot/util';
|
||||
|
||||
@ -46,12 +47,6 @@ function areParamsValid ({ creator: { meta: { type } } }: QueryableStorageEntry<
|
||||
(values.length === (type.isPlain ? 0 : type.asMap.hashers.length)));
|
||||
}
|
||||
|
||||
function expandSiKey (registry: Registry, key: SiLookupTypeId): string {
|
||||
const typeDef = registry.lookup.getTypeDef(key);
|
||||
|
||||
return typeDef.lookupName || typeDef.type;
|
||||
}
|
||||
|
||||
function expandParams (registry: Registry, st: StorageEntryTypeLatest, isIterable: boolean): ParamsType {
|
||||
let types: string[] = [];
|
||||
|
||||
@ -59,8 +54,8 @@ function expandParams (registry: Registry, st: StorageEntryTypeLatest, isIterabl
|
||||
const { hashers, key } = st.asMap;
|
||||
|
||||
types = hashers.length === 1
|
||||
? [expandSiKey(registry, key)]
|
||||
: registry.lookup.getSiType(key).def.asTuple.map((k) => expandSiKey(registry, k));
|
||||
? [getSiName(registry.lookup, key)]
|
||||
: registry.lookup.getSiType(key).def.asTuple.map((k) => getSiName(registry.lookup, k));
|
||||
}
|
||||
|
||||
return types.map((str, index) => {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user