From e24db78661a36223d973df29a8dbd56df14c3bd8 Mon Sep 17 00:00:00 2001 From: Russell Dempsey <1173416+SgtPooki@users.noreply.github.com> Date: Thu, 21 Nov 2024 10:00:39 -0600 Subject: [PATCH 1/3] chore: remove unnecessary any cast --- src/components/object-info/links-table.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/object-info/links-table.tsx b/src/components/object-info/links-table.tsx index e977fde0..0bedc274 100644 --- a/src/components/object-info/links-table.tsx +++ b/src/components/object-info/links-table.tsx @@ -54,7 +54,7 @@ const Row: React.FC = ({ onLinkClick, startIndex, index, rowHeight, li key={key} className={`pv2 pointer items-center f7 ${styles.rowGrid} bb b--near-white`} style={{ position: 'absolute', top: key * rowHeight, width: '100%', backgroundColor }} - onClick={() => { onLinkClick(link as any) }} + onClick={() => { onLinkClick(link) }} >
{key} From e226df663ee5975af540f990b525797ef284b094 Mon Sep 17 00:00:00 2001 From: Russell Dempsey <1173416+SgtPooki@users.noreply.github.com> Date: Thu, 21 Nov 2024 10:01:43 -0600 Subject: [PATCH 2/3] chore: fix return type on isTruthy --- src/lib/helpers.ts | 2 +- src/lib/resolve-ipld-path.ts | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/lib/helpers.ts b/src/lib/helpers.ts index 86226530..17bc81ef 100644 --- a/src/lib/helpers.ts +++ b/src/lib/helpers.ts @@ -19,7 +19,7 @@ export function isFalsy (str: T | null | string | undefined): str is null { return false } -export function isTruthy (str: T | null | string | undefined): boolean { +export function isTruthy (str: T | null | string | undefined): str is string { return !isFalsy(str) } diff --git a/src/lib/resolve-ipld-path.ts b/src/lib/resolve-ipld-path.ts index f66a10fb..0d3316e9 100644 --- a/src/lib/resolve-ipld-path.ts +++ b/src/lib/resolve-ipld-path.ts @@ -97,7 +97,6 @@ export async function ipldGetNodeAndRemainder (helia: Helia, sourceCid: CID | st const encodedValue = await getRawBlock(helia, cidInstance) const value = codecWrapper.decode(encodedValue) - // @ts-expect-error - limiting code changes, ignore this error const codecWrapperResolveResult = await codecWrapper.resolve(isTruthy(path) ? path : '/', encodedValue) // TODO: there was a type error previously uncaught const resolveValue: any = {} From 4343dc892489567772f9e9cedb48af830d7cdd5d Mon Sep 17 00:00:00 2001 From: Russell Dempsey <1173416+SgtPooki@users.noreply.github.com> Date: Thu, 21 Nov 2024 10:03:00 -0600 Subject: [PATCH 3/3] fix: links without paths can be navigated Fixes #461 --- src/lib/normalise-dag-node.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/normalise-dag-node.ts b/src/lib/normalise-dag-node.ts index 2b19a581..f85b2a60 100644 --- a/src/lib/normalise-dag-node.ts +++ b/src/lib/normalise-dag-node.ts @@ -93,7 +93,7 @@ export function normaliseDagPb (node: PBNode, cid: string, type: CodecType): Nor */ export function normaliseDagPbLinks (links: PBLink[], sourceCid: string): NormalizedDagLink[] { return links.map((link, index) => ({ - path: link.Name ?? `Links/${index}`, + path: isTruthy(link.Name) ? link.Name : `Links/${index}`, source: sourceCid, target: toCidStrOrNull(link.Hash) ?? '', size: BigInt(link.Tsize ?? 0),