Skip to content

Commit

Permalink
fix(vision): format non-object return values correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
rexxars committed Mar 24, 2021
1 parent aef1eb6 commit f8864cd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/@sanity/vision/src/components/ResultView.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import React from 'react'
import PropTypes from 'prop-types'
import ReactJsonView from 'react-json-view'

function isJSONValue(data) {
function isJsonObject(data) {
return data !== null && typeof data === 'object'
}

function ResultView(props) {
const {data} = props

return isJSONValue(data) ? (
return isJsonObject(data) ? (
<ReactJsonView
name="result"
src={data}
Expand All @@ -18,7 +18,7 @@ function ResultView(props) {
groupArraysAfterLength={50}
/>
) : (
<pre>{data || 'null'}</pre>
<pre>{data === null ? 'null' : data.toString()}</pre>
)
}

Expand Down

0 comments on commit f8864cd

Please sign in to comment.