explorer: prevent large slot number input stemming from hex strings (#15438)
* explorer: prevent large slot number input stemming from hex strings * explorer: support IE11
This commit is contained in:
parent
524da78e43
commit
5548e599fe
|
@ -3,13 +3,17 @@ import React from "react";
|
|||
import { ErrorCard } from "components/common/ErrorCard";
|
||||
import { BlockOverviewCard } from "components/block/BlockOverviewCard";
|
||||
|
||||
// IE11 doesn't support Number.MAX_SAFE_INTEGER
|
||||
const MAX_SAFE_INTEGER = 9007199254740991;
|
||||
|
||||
type Props = { slot: string };
|
||||
|
||||
export function BlockDetailsPage({ slot }: Props) {
|
||||
const slotNumber = Number(slot);
|
||||
let output = <ErrorCard text={`Block ${slot} is not valid`} />;
|
||||
|
||||
if (!isNaN(Number(slot))) {
|
||||
output = <BlockOverviewCard slot={Number(slot)} />;
|
||||
if (!isNaN(slotNumber) && slotNumber < MAX_SAFE_INTEGER) {
|
||||
output = <BlockOverviewCard slot={slotNumber} />;
|
||||
}
|
||||
|
||||
return (
|
||||
|
|
Loading…
Reference in New Issue