Skip to content

Commit

Permalink
chore: remove content from entitiesHaveEntitiesRoute list
Browse files Browse the repository at this point in the history
affects: @esri/hub-common
  • Loading branch information
vivzhang committed May 22, 2024
1 parent cd0f4de commit d0c5573
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions packages/common/src/content/_internal/internalContentUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,8 @@ export const getHubRelativeUrl = (
let contentUrl =
getSolutionUrl(type, identifier, typeKeywords) ||
getInitiativeTemplateUrl(type, identifier, typeKeywords);
const family = getFamily(type);
if (!contentUrl) {
const family = getFamily(type);
const familiesWithPluralizedRoute = [
"app",
"dataset",
Expand All @@ -273,15 +273,14 @@ export const getHubRelativeUrl = (
// the rule: route name is plural of family name
path = `/${family}s`;
}

contentUrl = identifier ? `${path}/${identifier}` : `${path}`;
const entitiesHaveEntitiesRoute = ["initiative", "project", "content"];
const entityType = getTypeFromEntity({ type });
// if there is no identifier and the entity does not have the entities route
// set up, do not return an url
if (!identifier && !entitiesHaveEntitiesRoute.includes(entityType)) {
contentUrl = "";
}
}
// TODO: once an entity has its entities route set up, add it to this list
const entitiesHaveEntitiesRoute = ["initiative", "project"];
// if there is no identifier and the entity does not have the entities route
// set up, do not return an url
if (!identifier && !entitiesHaveEntitiesRoute.includes(family)) {
contentUrl = "";
}
return contentUrl;
};
Expand Down

0 comments on commit d0c5573

Please sign in to comment.