Skip to content

Commit

Permalink
[schema] Fix edge case where accessing type.preview would fail (#215)
Browse files Browse the repository at this point in the history
  • Loading branch information
bjoerge authored and skogsmaskin committed Sep 29, 2017
1 parent 8cd4340 commit fa4109c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/@sanity/schema/src/preview/guessPreviewConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ function resolveFileAssetPath(typeDef) {
return fieldWithFileAsset ? `${fieldWithFileAsset.name}.asset` : undefined
}

export default function guessPreviewFields(objectTypeDef) {
export default function guessPreviewFields(rawObjectTypeDef) {
const objectTypeDef = {fields: [], ...rawObjectTypeDef}

const stringFieldNames = objectTypeDef.fields
.filter(field => field.type === 'string')
Expand Down

0 comments on commit fa4109c

Please sign in to comment.