Skip to content

Commit 0141a32

Browse files
committed
On JSON Big number detection, show it as primitive
1 parent ff88105 commit 0141a32

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

redisinsight/ui/src/components/json-viewer/components/json-pretty/JsonPretty.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ import { isArray, isObject } from 'uiSrc/components/json-viewer/utils'
77
import { IDefaultProps } from 'uiSrc/components/json-viewer/interfaces'
88

99
const JsonPretty = ({ data, ...props }: IDefaultProps) => {
10+
if (data?._isBigNumber) {
11+
return <JsonPrimitive data={data} {...props} />
12+
}
13+
1014
if (isArray(data)) {
1115
return <JsonArray data={data} {...props} />
1216
}

redisinsight/ui/src/utils/formatters/valueFormatters.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ const formattingBuffer = (
108108
try {
109109
const vector = Array.from(bufferToFloat32Array(reply.data as Uint8Array))
110110
const value = JSONBigInt.stringify(vector)
111-
return JSONViewer({ value, useNativeBigInt: false, ...props })
111+
return JSONViewer({ value, fallbackToNonBigInt: true, ...props })
112112
} catch (e) {
113113
return { value: bufferToUTF8(reply), isValid: false }
114114
}
@@ -117,7 +117,7 @@ const formattingBuffer = (
117117
try {
118118
const vector = Array.from(bufferToFloat64Array(reply.data as Uint8Array))
119119
const value = JSONBigInt.stringify(vector)
120-
return JSONViewer({ value, useNativeBigInt: false, ...props })
120+
return JSONViewer({ value, fallbackToNonBigInt: true, ...props })
121121
} catch (e) {
122122
return { value: bufferToUTF8(reply), isValid: false }
123123
}

0 commit comments

Comments
 (0)