Skip to content

Commit

Permalink
fix: render null if konnector not in registry
Browse files Browse the repository at this point in the history
If there is no registry data it is better to render nothing
because we won't have any link to the Konnector,
despite having its slug.
This is because failing to get the data most likely means
that the Service is not available
on the current registry (404 Not Found).
It is not a problem if the Service is not available on the registry,
but it is a problem if we try to link to it.
Here it would display an AppLinker with a grey cube,
an unformatted slug as a name and no working link.
  • Loading branch information
acezard committed Jul 6, 2023
1 parent 0318954 commit cfe73cb
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/components/FallbackCandidateServiceTile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,14 @@ const FallbackCandidateServiceTile = ({ slug }) => {
? get(registryData, 'latest_version.manifest.name', slug)
: ''

return (
/**
* If there is no registry data it is better to render nothing because we won't have any link to the Konnector, despite having its slug.
* This is because failing to get the data most likely means that the Service is not available on the current registry (404 Not Found).
*
* It is not a problem if the Service is not available on the registry, but it is a problem if we try to link to it.
* Here it would display an AppLinker with a grey cube, an unformatted slug as a name and no working link.
*/
return registryData ? (
<AppLinker
app={{ slug: app }}
nativePath={nativePath}
Expand All @@ -40,7 +47,7 @@ const FallbackCandidateServiceTile = ({ slug }) => {
</a>
)}
</AppLinker>
)
) : null
}

FallbackCandidateServiceTile.propTypes = {
Expand Down

0 comments on commit cfe73cb

Please sign in to comment.