Skip to content

Commit

Permalink
[field] PT: fix hook issue with useDiffAnnotationColor
Browse files Browse the repository at this point in the history
  • Loading branch information
skogsmaskin authored and rexxars committed Oct 6, 2020
1 parent 6852ad6 commit 62e27f7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ export default function Block(props: Props): JSX.Element {
alert('Focus object here!')
}

const color = useDiffAnnotationColor(diff, [])

// eslint-disable-next-line complexity
const renderBlock = ({
block,
Expand All @@ -49,7 +51,6 @@ export default function Block(props: Props): JSX.Element {
if (diff.action === 'changed' && diff.fields.style && diff.fields.style.action === 'changed') {
fromStyle = diff.fromValue.style
classNames.push(`changed_from_style_${fromStyle || 'undefined'}`)
const color = useDiffAnnotationColor(diff, [])
const style = color ? {background: color.background, color: color.text} : {}

returned = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ export default function Block(props: Props): JSX.Element {
alert('Focus object here!')
}

// eslint-disable-next-line complexity
const color = useDiffAnnotationColor(diff, [])

const renderBlock = ({
block,
children
Expand All @@ -66,7 +67,6 @@ export default function Block(props: Props): JSX.Element {
if (diff.action === 'changed' && diff.fields.style && diff.fields.style.action === 'changed') {
fromStyle = diff.fromValue.style
classNames.push(`changed_from_style_${fromStyle || 'undefined'}`)
const color = useDiffAnnotationColor(diff, [])
const style = color ? {background: color.background, color: color.text} : {}

returned = (
Expand Down

0 comments on commit 62e27f7

Please sign in to comment.