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

fix: Broken breadcrumbs when using custom BASE_URL #861

Merged
merged 1 commit into from
Jun 13, 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 @@ -35,7 +35,7 @@

constructor() {
this.breadcrumbSeeds = flyteBreadcrumbRegistryList;
this._makeRenderHash();

Check warning on line 38 in packages/oss-console/src/components/Breadcrumbs/registry/index.ts

View workflow job for this annotation

GitHub Actions / lint_project

Unexpected dangling '_' in '_makeRenderHash'
}

/**
Expand Down Expand Up @@ -84,12 +84,12 @@
});

this.breadcrumbSeeds[existingBreadcrumbIndex] = newBreadcrumb;
this._makeRenderHash();

Check warning on line 87 in packages/oss-console/src/components/Breadcrumbs/registry/index.ts

View workflow job for this annotation

GitHub Actions / lint_project

Unexpected dangling '_' in '_makeRenderHash'
return this.breadcrumbSeeds[existingBreadcrumbIndex];
}

this.breadcrumbSeeds.push(breadcrumbData);
this._makeRenderHash();

Check warning on line 92 in packages/oss-console/src/components/Breadcrumbs/registry/index.ts

View workflow job for this annotation

GitHub Actions / lint_project

Unexpected dangling '_' in '_makeRenderHash'
return breadcrumbData;
}

Expand All @@ -100,13 +100,13 @@
} else {
this.breadcrumbs.push(breadcrumb);
}
this._makeRenderHash();

Check warning on line 103 in packages/oss-console/src/components/Breadcrumbs/registry/index.ts

View workflow job for this annotation

GitHub Actions / lint_project

Unexpected dangling '_' in '_makeRenderHash'
return breadcrumb;
}

static makeUrlSegments(location: Location, projectId = '', domainId = '') {
const pathName = location.pathname;
const basePath = process.env.BASE_PATH || '/console';
Copy link
Contributor Author

@ddl-rliu ddl-rliu Apr 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe BASE_PATH may be a typo here, since the process.env object looks like

{
    NODE_ENV: "production",
    ADMIN_API: "//localhost:30080",
    ADMIN_API_URL: "localhost:30080",
    BASE_URL: "/console",
    BASE_HREF: "",
    DISABLE_CONSOLE_ROUTE_PREFIX: "",
    MAINTENANCE_MODE: ""
}

(in the case of a custom path, it looks like ... BASE_URL: "/custom-path/console"

And double checking the repo code, BASE_PATH has no other instance of usage, pointing to this being a potential typo.

const basePath = process.env.BASE_URL || '/console';

Check warning on line 109 in packages/oss-console/src/components/Breadcrumbs/registry/index.ts

View check run for this annotation

Codecov / codecov/patch

packages/oss-console/src/components/Breadcrumbs/registry/index.ts#L109

Added line #L109 was not covered by tests

// Remove first occurence of base path
const pathNameWithoutBasePath = pathName.replace(basePath, '');
Expand All @@ -133,7 +133,7 @@
}

// required segments, always visible
breadcrumbRegistry.breadcrumbSeeds

Check warning on line 136 in packages/oss-console/src/components/Breadcrumbs/registry/index.ts

View workflow job for this annotation

GitHub Actions / lint_project

'breadcrumbRegistry' was used before it was defined
.filter((b) => b.required)
.forEach((b) => {
if (!values[b.id]) {
Expand All @@ -152,7 +152,7 @@
*/
public resetBreadcrumbs() {
this.breadcrumbs = [];
this._makeRenderHash();

Check warning on line 155 in packages/oss-console/src/components/Breadcrumbs/registry/index.ts

View workflow job for this annotation

GitHub Actions / lint_project

Unexpected dangling '_' in '_makeRenderHash'
}

/**
Expand Down
Loading