mirror of
https://github.com/zkldi/Tachi.git
synced 2026-10-03 20:38:17 +03:00
fix: make seedsviewer for long arrays less disgusting
This commit is contained in:
@@ -4,13 +4,8 @@ import React from "react";
|
||||
export default function ObjCell({ data }: { data: unknown }) {
|
||||
return (
|
||||
<td className="text-start">
|
||||
{/* this kinda sucks. have we got a better way to do this? */}
|
||||
{FlattenValue(data)
|
||||
.filter((e) => e.value !== null)
|
||||
.filter(
|
||||
// hack to hide some annoying itg properties
|
||||
(e) => e.keychain[0] !== "npsPerMeasure" && e.keychain[0] !== "notesPerMeasure"
|
||||
)
|
||||
.map((e) => (
|
||||
<>
|
||||
<code>{StringifyKeyChain(e.keychain)}</code>: {JSON.stringify(e.value)}
|
||||
|
||||
@@ -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<string, unknown>, keychain);
|
||||
|
||||
Reference in New Issue
Block a user