Skip to content

Commit

Permalink
[dag block] Fixed reading error if the Block object field is null or …
Browse files Browse the repository at this point in the history
…undefined
  • Loading branch information
welbon committed Jun 26, 2024
1 parent 17d9da8 commit f1d32a2
Showing 1 changed file with 27 additions and 14 deletions.
41 changes: 27 additions & 14 deletions src/modules/Blocks/components/Detail/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -262,20 +262,33 @@ class Index extends PureComponent<IndexProps, IndexState> {
];

if (network === 'vega' || network === 'halley') {
columns.push(
[t('block.ParentsHash'),
header.parents_hash.map((hash: string) => (
<CommonLink key={hash} path={`/${network}/blocks/detail/${hash}`} title={hash} />
))
],
[t('block.DaaScore'),formatNumber(block.daa_score)],
[t('block.HeightgroupIndex'),formatNumber(block.heightgroup_index)],
[t('block.MergedBlueset'),
block.merged_blueset.map((hash: string) => (
<CommonLink key={hash} path={`/${network}/blocks/detail/${hash}`} title={hash} />
))
]
);
if (header.parents_hash !== null && header.parents_hash !== undefined) {
columns.push(
[t('block.ParentsHash'),
header.parents_hash.map((hash: string) => (
<CommonLink key={hash} path={`/${network}/blocks/detail/${hash}`} title={hash} />
))
]
);
}

if (block.daa_score !== null && block.daa_score !== undefined) {
columns.push([t('block.DaaScore'),formatNumber(block.daa_score)]);
}

if (block.heightgroup_index !== null && block.heightgroup_index !== undefined) {
columns.push([t('block.HeightgroupIndex'),formatNumber(block.heightgroup_index)]);
}

if (block.merged_blueset !== null && block.merged_blueset !== undefined) {
columns.push(
[t('block.MergedBlueset'),
block.merged_blueset.map((hash: string) => (
<CommonLink key={hash} path={`/${network}/blocks/detail/${hash}`} title={hash} />
)),
],
);
}
} else {
columns.push(
[t('block.ParentHash'),
Expand Down

0 comments on commit f1d32a2

Please sign in to comment.