Skip to content

Commit

Permalink
[form-builder] Support change indicator on array items
Browse files Browse the repository at this point in the history
  • Loading branch information
bjoerge authored and rexxars committed Oct 6, 2020
1 parent 0ffdc20 commit a8403e6
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import ConfirmButton from './ConfirmButton'
import styles from './styles/ItemValue.css'
import {ArrayType, ItemValue} from './typedefs'
import InvalidItem from './InvalidItem'
import {ContextProvidedChangeIndicator} from '@sanity/base/lib/change-indicators/ChangeIndicator'

const DragHandle = createDragHandle(() => (
<span className={styles.dragHandle}>
Expand Down Expand Up @@ -272,7 +273,6 @@ export default class RenderItemValue extends React.PureComponent<Props> {
if (!memberType) {
return <InvalidItem onChange={this.handleChange} type={type} value={value} />
}

return (
<ChangeIndicatorScope path={[{_key: value._key}]}>
<div className={styles.inner}>
Expand All @@ -289,8 +289,10 @@ export default class RenderItemValue extends React.PureComponent<Props> {
className={styles.previewWrapperHelper}
onFocus={this.handleFocus}
>
{!value._key && <div className={styles.missingKeyMessage}>Missing key</div>}
<Preview layout={previewLayout} value={value} type={memberType} />
<ContextProvidedChangeIndicator compareDeep disabled={hasItemFocus}>
{!value._key && <div className={styles.missingKeyMessage}>Missing key</div>}
<Preview layout={previewLayout} value={value} type={memberType} />
</ContextProvidedChangeIndicator>
</div>
</div>

Expand Down

0 comments on commit a8403e6

Please sign in to comment.