diff --git a/src/pages/block/[hash].tsx b/src/pages/block/[hash].tsx index d16965d..9b90f55 100644 --- a/src/pages/block/[hash].tsx +++ b/src/pages/block/[hash].tsx @@ -62,7 +62,7 @@ function Block(props: BlockProps) { useEffect(() => { async function fetchHash() { - if (!height) return; + if (height === null) return; const prevHashFetched = await Fetch.getHashByHeight(height - 1); const nextHashFetched = await Fetch.getHashByHeight(height + 1); setPrevHash(prevHashFetched); diff --git a/src/utils/methods.ts b/src/utils/methods.ts index 6a79d1e..7b34e73 100644 --- a/src/utils/methods.ts +++ b/src/utils/methods.ts @@ -42,6 +42,8 @@ class Fetch { } static async getHashByHeight(height: number): Promise { + if (height === -1) return ""; + const result = await this.getBlockDetails(height, 1); if (result.success === false) return null; if (!(result instanceof Array)) return null;