Skip to content

Commit

Permalink
[import] Don't override _type for imported assets (#1288)
Browse files Browse the repository at this point in the history
  • Loading branch information
rexxars committed May 3, 2019
1 parent f9b3918 commit 372d1f7
Show file tree
Hide file tree
Showing 2 changed files with 196 additions and 131 deletions.
17 changes: 10 additions & 7 deletions packages/@sanity/import/src/uploadAssets.js
Expand Up @@ -236,13 +236,16 @@ function getAssetType(assetId) {

function reducePatch(trx, task) {
return trx.patch(task.documentId, patch =>
patch.setIfMissing({[task.path]: {}}).set({
[`${task.path}._type`]: getAssetType(task.assetId),
[`${task.path}.asset`]: {
_type: 'reference',
_ref: task.assetId
}
})
patch
.setIfMissing({
[task.path]: {_type: getAssetType(task.assetId)}
})
.set({
[`${task.path}.asset`]: {
_type: 'reference',
_ref: task.assetId
}
})
)
}

Expand Down

0 comments on commit 372d1f7

Please sign in to comment.