Skip to content

Commit

Permalink
display empty state if data is null
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeRx committed Nov 8, 2022
1 parent 7bb8662 commit 854b61f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions ui/components/app/confirm-page-container/flask/snap-insight.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const SnapInsight = ({ transaction, chainId, selectedSnap }) => {

const data = response?.insights;

const hasNoData = (!data || !Object.keys(data).length) && !error;
const hasNoData = (!data || (data && !Object.keys(data).length)) && !error;

return (
<Box
Expand All @@ -40,13 +40,13 @@ export const SnapInsight = ({ transaction, chainId, selectedSnap }) => {
textAlign={hasNoData && TEXT_ALIGN.CENTER}
className="snap-insight"
>
{data && !error && (
{response && !error && (
<Box
height="full"
flexDirection={FLEX_DIRECTION.COLUMN}
className="snap-insight__container"
>
{Object.keys(data).length ? (
{data && Object.keys(data).length ? (
<>
<Box
flexDirection={FLEX_DIRECTION.COLUMN}
Expand Down Expand Up @@ -96,7 +96,7 @@ export const SnapInsight = ({ transaction, chainId, selectedSnap }) => {
)}
</Box>
)}
{!data && !error && (
{!response && !error && (
<>
<Preloader size={40} />
<Typography
Expand All @@ -108,7 +108,7 @@ export const SnapInsight = ({ transaction, chainId, selectedSnap }) => {
</Typography>
</>
)}
{!data && error && (
{!response && error && (
<Box
paddingTop={0}
paddingRight={6}
Expand Down

0 comments on commit 854b61f

Please sign in to comment.