Skip to content

Commit

Permalink
Updates error handling in SearchRepository component to simplify and …
Browse files Browse the repository at this point in the history
…combine error and empty state handling
  • Loading branch information
jrhoads committed Feb 4, 2025
1 parent 7bcddd9 commit 9647510
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions src/components/SearchRepository/SearchRepository.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import Link from 'next/link'
import Pager from 'src/components/Pager/Pager'
import FairFilter from 'src/components/FairFilter/FairFilter'
import FacetList from 'src/components/FacetList/FacetList'
import Error from 'src/components/Error/Error'
import Loading from 'src/components/Loading/Loading'
import RepositoryMetadata from 'src/components/RepositoryMetadata/RepositoryMetadata'

Expand All @@ -28,18 +27,10 @@ export default function SearchRepositories({ variables }: Props) {

if (loading) return <Row><Loading /></Row>

if (error) return (
<Row>
<Col md={{ span: 9, offset: 3 }}>
<Error title="An error occured." message={error.message} />
</Col>
</Row>
)


const repositories = data?.repositories

if (!repositories || repositories.nodes.length == 0) return (
if (error || !repositories || repositories.nodes.length == 0) return (
<Col md={{ span: 9, offset: 3 }}>
<div className="alert-works">
<Alert variant="warning">
Expand Down

0 comments on commit 9647510

Please sign in to comment.