Skip to content

Commit

Permalink
fix(data-warehouse): Fixed react hook ordering (#22907)
Browse files Browse the repository at this point in the history
* Fixed react hook ordering

* Moved the memo further up

* Update UI snapshots for `chromium` (2)

* Update UI snapshots for `chromium` (2)

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
Gilbert09 and github-actions[bot] authored Jun 12, 2024
1 parent 23acd14 commit 78ed4f2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,24 @@ function DefinitionView({ group }: { group: TaxonomicFilterGroup }): JSX.Element
}
}, [definition])

const hasSentAsLabel = useMemo(() => {
const _definition = definition as PropertyDefinition

if (!_definition) {
return null
}

if (isDataWarehousePersonProperty) {
return _definition.id
}

if (_definition.name !== '') {
return _definition.name
}

return <i>(empty string)</i>
}, [isDataWarehousePersonProperty, definition, isProperty])

if (!definition) {
return <></>
}
Expand Down Expand Up @@ -174,19 +192,9 @@ function DefinitionView({ group }: { group: TaxonomicFilterGroup }): JSX.Element
</>
)
}

if (isProperty) {
const _definition = definition as PropertyDefinition
const hasSentAsLabel = useMemo(() => {
if (isDataWarehousePersonProperty) {
return _definition.id
}

if (_definition.name !== '') {
return _definition.name
}

return <i>(empty string)</i>
}, [isDataWarehousePersonProperty, _definition])

return (
<>
Expand Down

0 comments on commit 78ed4f2

Please sign in to comment.