Skip to content

Commit

Permalink
[form-builder] Fix focus/change determination for reference input
Browse files Browse the repository at this point in the history
  • Loading branch information
rexxars committed Oct 6, 2020
1 parent 646fb5e commit 7291346
Showing 1 changed file with 4 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
SanityDocument
} from '@sanity/types'
import {FOCUS_TERMINATOR, get} from '@sanity/util/paths'
import {ChangeIndicatorProvider} from '@sanity/base/lib/change-indicators'
import {ChangeIndicatorCompareValueProvider} from '@sanity/base/lib/change-indicators/ChangeIndicator'
import LinkIcon from 'part:@sanity/base/link-icon'
import {IntentLink} from 'part:@sanity/base/router'
import Button from 'part:@sanity/components/buttons/default'
Expand Down Expand Up @@ -243,16 +243,7 @@ export default withValuePath(
this._input = input
}
render() {
const {
type,
value,
level,
markers,
readOnly,
presence,
focusPath,
compareValue
} = this.props
const {type, value, level, markers, readOnly, presence, compareValue} = this.props
const {previewSnapshot, isFetching, isMissing, hits} = this.state
const valueFromHit = value && hits.find(hit => hit._id === value._ref)
const weakIs = value && value._weak ? 'weak' : 'strong'
Expand All @@ -268,9 +259,7 @@ export default withValuePath(
const isLoadingSnapshot = value && value._ref && !previewSnapshot
const placeholder = isLoadingSnapshot ? 'Loading…' : 'Type to search…'
return (
<ChangeIndicatorProvider
path={[]}
focusPath={focusPath}
<ChangeIndicatorCompareValueProvider
value={value?._ref}
compareValue={compareValue?._ref}
>
Expand Down Expand Up @@ -317,7 +306,7 @@ export default withValuePath(
/>
</div>
</FormField>
</ChangeIndicatorProvider>
</ChangeIndicatorCompareValueProvider>
)
}
}
Expand Down

0 comments on commit 7291346

Please sign in to comment.