Skip to content

Commit 6b32267

Browse files
committed
Handle invalid type used in fields uniqueKeys
1 parent bd42c86 commit 6b32267

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/components/HtmlFormat.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export default function HtmlFormat(props: HtmlFormatProps) {
1919
const isArray = useMemo(() => Array.isArray(value), [value])
2020
const keyFmt = (s: string) => humanify(s)
2121
const getAttrs = (k: string) => fieldAttrs ? fieldAttrs(k) : null
22-
const fields = useMemo(() => uniqueKeys(value), [value])
22+
const fields = useMemo(() => isArray ? uniqueKeys(value) : [], [value, isArray])
2323
const rows = (val: any) => val ? Object.keys(val).map(k => ({ key: keyFmt(k), val: val[k] })) : []
2424

2525
const formattedValue = useMemo(() => formatValue(value), [value])

0 commit comments

Comments
 (0)