Skip to content

Commit

Permalink
minor: fallback on the project id if the namespace is missing (#3353)
Browse files Browse the repository at this point in the history
  • Loading branch information
ciyer authored Oct 16, 2024
1 parent d9d5570 commit 4fdd953
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions client/src/features/searchV2/components/SearchV2Results.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ interface SearchV2ResultProjectProps {
project: Project;
}
function SearchV2ResultProject({ project }: SearchV2ResultProjectProps) {
const { creationDate, description, name, namespace, slug, visibility } =
const { creationDate, description, id, name, namespace, slug, visibility } =
project;

const namespaceUrl =
Expand All @@ -274,10 +274,15 @@ function SearchV2ResultProject({ project }: SearchV2ResultProjectProps) {
: generatePath(ABSOLUTE_ROUTES.v2.groups.show.root, {
slug: namespace?.namespace ?? "",
});
const projectUrl = generatePath(ABSOLUTE_ROUTES.v2.projects.show.root, {
namespace: namespace?.namespace ?? "",
slug,
});
const projectUrl =
namespace?.namespace != null
? generatePath(ABSOLUTE_ROUTES.v2.projects.show.root, {
namespace: namespace.namespace,
slug,
})
: generatePath(ABSOLUTE_ROUTES.v2.projects.showById, {
id,
});

return (
<SearchV2ResultsContainer>
Expand Down

0 comments on commit 4fdd953

Please sign in to comment.