Skip to content

Commit

Permalink
[field] Only render preview component on unchanged diffs
Browse files Browse the repository at this point in the history
  • Loading branch information
rexxars committed Oct 6, 2020
1 parent 104e336 commit 855f96c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/@sanity/field/src/diff/components/Change.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ export function Change({
previewComponent: PreviewComponent
}: ChangeProps) {
const containerClassName = className ? `${styles.root} ${className}` : styles.root
const {fromValue, toValue} = diff
const {fromValue, toValue, action} = diff

if (action === 'unchanged') {
return <PreviewComponent value={toValue} schemaType={schemaType} />
}

const from = hasValue(fromValue) ? (
<DiffAnnotationCard as="del" className={styles.remove} diff={diff}>
<PreviewComponent value={fromValue} schemaType={schemaType} />
Expand Down

0 comments on commit 855f96c

Please sign in to comment.