File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
src/features/common/components Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 1- import { JsonView as ReactJsonView , allExpanded } from 'react-json-view-lite'
1+ import { JsonView as ReactJsonView } from 'react-json-view-lite'
22import 'react-json-view-lite/dist/index.css'
33import styles from './json-view.module.css'
44import { cn } from '../utils'
@@ -39,10 +39,14 @@ export function JsonView({ json }: { json: object }) {
3939 < Button className = { cn ( 'absolute top-4 right-4' ) } onClick = { copyJsonToClipboard } >
4040 Copy
4141 </ Button >
42- < ReactJsonView data = { json } shouldExpandNode = { allExpanded } style = { style } />
42+ < ReactJsonView data = { json } shouldExpandNode = { shouldExpandNode } style = { style } />
4343 </ div >
4444 )
4545}
46+ // Only render the top level because sometimes the object has too many children to render
47+ const shouldExpandNode = ( level : number ) => {
48+ return level < 1
49+ }
4650
4751export interface StyleProps {
4852 container : string
You can’t perform that action at this time.
0 commit comments