nextFreeParaId default value (#5250)

This commit is contained in:
Jaco 2021-05-10 15:12:09 +03:00 committed by GitHub
parent 26acc4ef6f
commit 8fbf916702
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,9 +1,9 @@
// Copyright 2017-2021 @polkadot/app-parachains authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type BN from 'bn.js';
import type { ParaId } from '@polkadot/types/interfaces';
import BN from 'bn.js';
import React, { useCallback, useState } from 'react';
import { InputAddress, InputFile, InputNumber, Modal, TxButton } from '@polkadot/react-components';
@ -17,6 +17,8 @@ interface Props {
onClose: () => void;
}
const LOWEST_PUBLIC_ID = new BN(2_000);
function RegisterThread ({ className, onClose }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const { api } = useApi();
@ -55,7 +57,7 @@ function RegisterThread ({ className, onClose }: Props): React.ReactElement<Prop
{api.tx.registrar.registerNext
? (
<InputNumber
defaultValue={nextParaId}
defaultValue={(nextParaId && !nextParaId.isZero()) ? nextParaId : LOWEST_PUBLIC_ID}
isDisabled
isZeroable={false}
label={t<string>('parachain id')}