Skip to content

Commit

Permalink
add explicit empty fallback for home view sections
Browse files Browse the repository at this point in the history
  • Loading branch information
brainbicycle committed Oct 3, 2024
1 parent 7e3870b commit 20f464a
Show file tree
Hide file tree
Showing 14 changed files with 203 additions and 147 deletions.
24 changes: 14 additions & 10 deletions src/app/Scenes/HomeView/Sections/HomeViewSectionActivity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -187,14 +187,18 @@ const HomeViewSectionActivityPlaceholder: React.FC = () => {

export const HomeViewSectionActivityQueryRenderer: React.FC<{
sectionID: string
}> = withSuspense((props) => {
const data = useLazyLoadQuery<HomeViewSectionActivityQuery>(homeViewSectionActivityQuery, {
id: props.sectionID,
})

if (!data.homeView.section) {
return null
}
}> = withSuspense(
(props) => {
const data = useLazyLoadQuery<HomeViewSectionActivityQuery>(homeViewSectionActivityQuery, {
id: props.sectionID,
})

if (!data.homeView.section) {
return null
}

return <HomeViewSectionActivity section={data.homeView.section} />
}, HomeViewSectionActivityPlaceholder)
return <HomeViewSectionActivity section={data.homeView.section} />
},
HomeViewSectionActivityPlaceholder,
undefined
)
22 changes: 13 additions & 9 deletions src/app/Scenes/HomeView/Sections/HomeViewSectionArticles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,18 @@ const HomeViewSectionArticlesPlaceholder: React.FC = () => {

export const HomeViewSectionArticlesQueryRenderer: React.FC<{
sectionID: string
}> = withSuspense((props) => {
const data = useLazyLoadQuery<HomeViewSectionArticlesQuery>(homeViewSectionArticlesQuery, {
id: props.sectionID,
})
}> = withSuspense(
(props) => {
const data = useLazyLoadQuery<HomeViewSectionArticlesQuery>(homeViewSectionArticlesQuery, {
id: props.sectionID,
})

if (!data.homeView.section) {
return null
}
if (!data.homeView.section) {
return null
}

return <HomeViewSectionArticles section={data.homeView.section} />
}, HomeViewSectionArticlesPlaceholder)
return <HomeViewSectionArticles section={data.homeView.section} />
},
HomeViewSectionArticlesPlaceholder,
undefined
)
28 changes: 16 additions & 12 deletions src/app/Scenes/HomeView/Sections/HomeViewSectionArticlesCards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -172,17 +172,21 @@ const homeViewSectionArticlesCardsQuery = graphql`

export const HomeViewSectionArticlesCardsQueryRenderer: React.FC<{
sectionID: string
}> = withSuspense((props) => {
const data = useLazyLoadQuery<HomeViewSectionArticlesCardsQuery>(
homeViewSectionArticlesCardsQuery,
{
id: props.sectionID,
}
)
}> = withSuspense(
(props) => {
const data = useLazyLoadQuery<HomeViewSectionArticlesCardsQuery>(
homeViewSectionArticlesCardsQuery,
{
id: props.sectionID,
}
)

if (!data.homeView.section) {
return null
}
if (!data.homeView.section) {
return null
}

return <HomeViewSectionArticlesCards section={data.homeView.section} />
}, HomeViewSectionArticlesCardsPlaceholder)
return <HomeViewSectionArticlesCards section={data.homeView.section} />
},
HomeViewSectionArticlesCardsPlaceholder,
undefined
)
22 changes: 13 additions & 9 deletions src/app/Scenes/HomeView/Sections/HomeViewSectionArtists.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -238,14 +238,18 @@ const HomeViewSectionArtistsPlaceholder: React.FC = () => {

export const HomeViewSectionArtistsQueryRenderer: React.FC<{
sectionID: string
}> = withSuspense((props) => {
const data = useLazyLoadQuery<HomeViewSectionArtistsMainQuery>(homeViewSectionArtistsQuery, {
id: props.sectionID,
})
}> = withSuspense(
(props) => {
const data = useLazyLoadQuery<HomeViewSectionArtistsMainQuery>(homeViewSectionArtistsQuery, {
id: props.sectionID,
})

if (!data.homeView.section) {
return null
}
if (!data.homeView.section) {
return null
}

return <HomeViewSectionArtistsPaginationContainer section={data.homeView.section} />
}, HomeViewSectionArtistsPlaceholder)
return <HomeViewSectionArtistsPaginationContainer section={data.homeView.section} />
},
HomeViewSectionArtistsPlaceholder,
undefined
)
24 changes: 14 additions & 10 deletions src/app/Scenes/HomeView/Sections/HomeViewSectionArtworks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,18 @@ const HomeViewSectionArtworksPlaceholder: React.FC = () => {

export const HomeViewSectionArtworksQueryRenderer: React.FC<{
sectionID: string
}> = withSuspense((props) => {
const data = useLazyLoadQuery<HomeViewSectionArtworksQuery>(homeViewSectionArtworksQuery, {
id: props.sectionID,
})

if (!data.homeView.section) {
return null
}
}> = withSuspense(
(props) => {
const data = useLazyLoadQuery<HomeViewSectionArtworksQuery>(homeViewSectionArtworksQuery, {
id: props.sectionID,
})

if (!data.homeView.section) {
return null
}

return <HomeViewSectionArtworks section={data.homeView.section} />
}, HomeViewSectionArtworksPlaceholder)
return <HomeViewSectionArtworks section={data.homeView.section} />
},
HomeViewSectionArtworksPlaceholder,
undefined
)
28 changes: 16 additions & 12 deletions src/app/Scenes/HomeView/Sections/HomeViewSectionAuctionResults.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -189,17 +189,21 @@ const homeViewSectionAuctionResultsQuery = graphql`

export const HomeViewSectionAuctionResultsQueryRenderer: React.FC<{
sectionID: string
}> = withSuspense((props) => {
const data = useLazyLoadQuery<HomeViewSectionAuctionResultsQuery>(
homeViewSectionAuctionResultsQuery,
{
id: props.sectionID,
}
)
}> = withSuspense(
(props) => {
const data = useLazyLoadQuery<HomeViewSectionAuctionResultsQuery>(
homeViewSectionAuctionResultsQuery,
{
id: props.sectionID,
}
)

if (!data.homeView.section) {
return null
}
if (!data.homeView.section) {
return null
}

return <HomeViewSectionAuctionResults section={data.homeView.section} />
}, HomeViewSectionAuctionResultsPlaceholder)
return <HomeViewSectionAuctionResults section={data.homeView.section} />
},
HomeViewSectionAuctionResultsPlaceholder,
undefined
)
24 changes: 14 additions & 10 deletions src/app/Scenes/HomeView/Sections/HomeViewSectionFairs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -176,14 +176,18 @@ const homeViewSectionFairsQuery = graphql`

export const HomeViewSectionFairsQueryRenderer: React.FC<{
sectionID: string
}> = withSuspense((props) => {
const data = useLazyLoadQuery<HomeViewSectionFairsQuery>(homeViewSectionFairsQuery, {
id: props.sectionID,
})

if (!data.homeView.section) {
return null
}
}> = withSuspense(
(props) => {
const data = useLazyLoadQuery<HomeViewSectionFairsQuery>(homeViewSectionFairsQuery, {
id: props.sectionID,
})

if (!data.homeView.section) {
return null
}

return <HomeViewSectionFairs section={data.homeView.section} />
}, HomeViewSectionFairsPlaceholder)
return <HomeViewSectionFairs section={data.homeView.section} />
},
HomeViewSectionFairsPlaceholder,
undefined
)
Original file line number Diff line number Diff line change
Expand Up @@ -179,17 +179,21 @@ const homeViewSectionFeaturedCollectionQuery = graphql`

export const HomeViewSectionFeaturedCollectionQueryRenderer: React.FC<{
sectionID: string
}> = withSuspense((props) => {
const data = useLazyLoadQuery<HomeViewSectionFeaturedCollectionQuery>(
homeViewSectionFeaturedCollectionQuery,
{
id: props.sectionID,
}
)
}> = withSuspense(
(props) => {
const data = useLazyLoadQuery<HomeViewSectionFeaturedCollectionQuery>(
homeViewSectionFeaturedCollectionQuery,
{
id: props.sectionID,
}
)

if (!data.homeView.section) {
return null
}
if (!data.homeView.section) {
return null
}

return <HomeViewSectionFeaturedCollection section={data.homeView.section} />
}, HomeViewSectionFeaturedCollectionPlaceholder)
return <HomeViewSectionFeaturedCollection section={data.homeView.section} />
},
HomeViewSectionFeaturedCollectionPlaceholder,
undefined
)
24 changes: 14 additions & 10 deletions src/app/Scenes/HomeView/Sections/HomeViewSectionGalleries.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,18 @@ const homeViewSectionGalleriesQuery = graphql`

export const HomeViewSectionGalleriesQueryRenderer: React.FC<{
sectionID: string
}> = withSuspense((props) => {
const data = useLazyLoadQuery<HomeViewSectionGalleriesQuery>(homeViewSectionGalleriesQuery, {
id: props.sectionID,
})

if (!data.homeView.section) {
return null
}
}> = withSuspense(
(props) => {
const data = useLazyLoadQuery<HomeViewSectionGalleriesQuery>(homeViewSectionGalleriesQuery, {
id: props.sectionID,
})

if (!data.homeView.section) {
return null
}

return <HomeViewSectionGalleries section={data.homeView.section} />
}, HomeViewSectionGalleriesPlaceholder)
return <HomeViewSectionGalleries section={data.homeView.section} />
},
HomeViewSectionGalleriesPlaceholder,
undefined
)
24 changes: 14 additions & 10 deletions src/app/Scenes/HomeView/Sections/HomeViewSectionHeroUnits.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,18 @@ const homeViewSectionHeroUnitsQuery = graphql`

export const HomeViewSectionHeroUnitsQueryRenderer: React.FC<{
sectionID: string
}> = withSuspense((props) => {
const data = useLazyLoadQuery<HomeViewSectionHeroUnitsQuery>(homeViewSectionHeroUnitsQuery, {
id: props.sectionID,
})

if (!data.homeView.section) {
return null
}
}> = withSuspense(
(props) => {
const data = useLazyLoadQuery<HomeViewSectionHeroUnitsQuery>(homeViewSectionHeroUnitsQuery, {
id: props.sectionID,
})

if (!data.homeView.section) {
return null
}

return <HomeViewSectionHeroUnits section={data.homeView.section} />
}, HomeViewSectionHeroUnitsPlaceholder)
return <HomeViewSectionHeroUnits section={data.homeView.section} />
},
HomeViewSectionHeroUnitsPlaceholder,
undefined
)
Original file line number Diff line number Diff line change
Expand Up @@ -213,17 +213,21 @@ const homeViewSectionMarketingCollectionsQuery = graphql`

export const HomeViewSectionMarketingCollectionsQueryRenderer: React.FC<{
sectionID: string
}> = withSuspense((props) => {
const data = useLazyLoadQuery<HomeViewSectionMarketingCollectionsQuery>(
homeViewSectionMarketingCollectionsQuery,
{
id: props.sectionID,
}
)
}> = withSuspense(
(props) => {
const data = useLazyLoadQuery<HomeViewSectionMarketingCollectionsQuery>(
homeViewSectionMarketingCollectionsQuery,
{
id: props.sectionID,
}
)

if (!data.homeView.section) {
return null
}
if (!data.homeView.section) {
return null
}

return <HomeViewSectionMarketingCollections section={data.homeView.section} />
}, HomeViewSectionMarketingCollectionsPlaceholder)
return <HomeViewSectionMarketingCollections section={data.homeView.section} />
},
HomeViewSectionMarketingCollectionsPlaceholder,
undefined
)
24 changes: 14 additions & 10 deletions src/app/Scenes/HomeView/Sections/HomeViewSectionSales.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,14 +192,18 @@ const homeViewSectionSalesQuery = graphql`

export const HomeViewSectionSalesQueryRenderer: React.FC<{
sectionID: string
}> = withSuspense((props) => {
const data = useLazyLoadQuery<HomeViewSectionSalesQuery>(homeViewSectionSalesQuery, {
id: props.sectionID,
})

if (!data.homeView.section) {
return null
}
}> = withSuspense(
(props) => {
const data = useLazyLoadQuery<HomeViewSectionSalesQuery>(homeViewSectionSalesQuery, {
id: props.sectionID,
})

if (!data.homeView.section) {
return null
}

return <HomeViewSectionSales section={data.homeView.section} />
}, HomeViewSectionSalesPlaceholder)
return <HomeViewSectionSales section={data.homeView.section} />
},
HomeViewSectionSalesPlaceholder,
undefined
)
22 changes: 13 additions & 9 deletions src/app/Scenes/HomeView/Sections/HomeViewSectionShows.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,18 @@ const homeViewSectionShowsQuery = graphql`

export const HomeViewSectionShowsQueryRenderer: React.FC<{
sectionID: string
}> = withSuspense((props) => {
const data = useLazyLoadQuery<HomeViewSectionShowsQuery>(homeViewSectionShowsQuery, {
id: props.sectionID,
})
}> = withSuspense(
(props) => {
const data = useLazyLoadQuery<HomeViewSectionShowsQuery>(homeViewSectionShowsQuery, {
id: props.sectionID,
})

if (!data.homeView.section) {
return null
}
if (!data.homeView.section) {
return null
}

return <HomeViewSectionShows section={data.homeView.section} />
}, HomeViewSectionShowsPlaceholder)
return <HomeViewSectionShows section={data.homeView.section} />
},
HomeViewSectionShowsPlaceholder,
undefined
)
Loading

0 comments on commit 20f464a

Please sign in to comment.