From 3f5c56ffd607544d8afae14fd092dc534f3871ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s?= <105802444+kilted-andres@users.noreply.github.com> Date: Wed, 11 Sep 2024 11:32:23 +0200 Subject: [PATCH] fix: block component block not available yet (#745) During a regression test after [ctypehub/pull/743](https://github.com/galaniprojects/ctypehub/pull/743), it was found that the "Registration Block" component was showing a broken link after creating a cType from inside the app. This was because the block was still not available and the link required the block number. Now: - The component will direct to the polkadot.js explorer (without querying a specific block) when block number is undefined. Reverted: - ~When submitting a cType creation transaction, it will be awaited until it is _InBlock_.~ ## Other fix: Handle cTypes without a title. --- src/components/CTypeDetails/CTypeDetails.astro | 6 ++---- src/components/CTypeOverview/CTypeOverview.astro | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/components/CTypeDetails/CTypeDetails.astro b/src/components/CTypeDetails/CTypeDetails.astro index 6f02bf30..bb708cce 100644 --- a/src/components/CTypeDetails/CTypeDetails.astro +++ b/src/components/CTypeDetails/CTypeDetails.astro @@ -53,7 +53,7 @@ linkToW3N.pathname = web3Name ?? creator; const linkToBlock = new URL(`https://polkadot.js.org/apps/`); linkToBlock.searchParams.set('rpc', blockchainEndpoint); -linkToBlock.hash = `/explorer/query/${block}`; +linkToBlock.hash = `/explorer/${block ? 'query/' + block : ''}`; ---
@@ -99,9 +99,7 @@ linkToBlock.hash = `/explorer/query/${block}`;
Registration Block - - {block} - + {block}
{ diff --git a/src/components/CTypeOverview/CTypeOverview.astro b/src/components/CTypeOverview/CTypeOverview.astro index 88e9244a..9efb587c 100644 --- a/src/components/CTypeOverview/CTypeOverview.astro +++ b/src/components/CTypeOverview/CTypeOverview.astro @@ -16,7 +16,7 @@ const { title, id, description, attestationsCreated, tags } =
  • - {title} + {title || '∅'}