From b69ba0307a963025632182f8de3abe9d4e595df4 Mon Sep 17 00:00:00 2001 From: zkldi <20380519+zkldi@users.noreply.github.com> Date: Mon, 30 Oct 2023 15:49:15 +0000 Subject: [PATCH] fix: make seedsviewer for long arrays less disgusting --- client/src/components/tables/cells/ObjCell.tsx | 5 ----- client/src/util/misc.ts | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/client/src/components/tables/cells/ObjCell.tsx b/client/src/components/tables/cells/ObjCell.tsx index ed34c2b2f..c0d192668 100644 --- a/client/src/components/tables/cells/ObjCell.tsx +++ b/client/src/components/tables/cells/ObjCell.tsx @@ -4,13 +4,8 @@ import React from "react"; export default function ObjCell({ data }: { data: unknown }) { return (
{StringifyKeyChain(e.keychain)}
: {JSON.stringify(e.value)}
diff --git a/client/src/util/misc.ts b/client/src/util/misc.ts
index 14b6de902..d068e9bfd 100644
--- a/client/src/util/misc.ts
+++ b/client/src/util/misc.ts
@@ -384,6 +384,11 @@ export function FlattenValue(
keychain: string[] = []
): Array<{ keychain: string[]; value: unknown }> {
if (Array.isArray(value)) {
+ // probably not a tuple, don't make this thing super long.
+ if (value.length > 5) {
+ return [{ keychain, value: value.join(", ") }];
+ }
+
return value.flatMap((e, i) => FlattenValue(e, [...keychain, i.toString()]));
} else if (typeof value === "object" && value !== null) {
return FlattenRecord(value as Record