Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow url objects for explore links to have a path before the entity name (#291) #292

Merged
merged 1 commit into from
Dec 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export const ExploreViewLink = ({
* @returns entity list type.
*/
function getEntityListType(href: UrlObjectWithHrefAndQuery["href"]): string {
return href.substring(1);
return href.substring(href.lastIndexOf("/") + 1);
}

/**
Expand Down Expand Up @@ -139,7 +139,7 @@ function isValidExploreURL(
}

/**
* Returns true if the given href is a configured key in the explore state's entityPageState.
* Returns true if the given href is a path ending with a configured key in the explore state's entityPageState.
* @param url - Explore link URL.
* @param exploreState - Explore state.
* @returns true if the given href is configured in the explore state.
Expand All @@ -150,7 +150,10 @@ function isValidHref(
): boolean {
const { entityPageState } = exploreState;
const { href } = url;
return href.startsWith("/") && href.substring(1) in entityPageState;
return (
href.startsWith("/") &&
href.substring(href.lastIndexOf("/") + 1) in entityPageState
);
}

/**
Expand Down
Loading