Skip to content

Commit 8ac6a85

Browse files
authored
fix: Fix showing selected navigation item in UI sidebar (feast-dev#4969)
1 parent dc2c1dc commit 8ac6a85

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

ui/src/pages/Sidebar.tsx

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,58 +55,60 @@ const SideNav = () => {
5555
: ""
5656
}`;
5757

58+
const baseUrl = `${process.env.PUBLIC_URL || ""}/p/${projectName}`;
59+
5860
const sideNav = [
5961
{
6062
name: "Home",
6163
id: htmlIdGenerator("basicExample")(),
6264
onClick: () => {
63-
navigate(`${process.env.PUBLIC_URL || ""}/p/${projectName}/`);
65+
navigate(`${baseUrl}/`);
6466
},
6567
items: [
6668
{
6769
name: dataSourcesLabel,
6870
id: htmlIdGenerator("dataSources")(),
6971
icon: <EuiIcon type={DataSourceIcon} />,
7072
onClick: () => {
71-
navigate(`${process.env.PUBLIC_URL || ""}/p/${projectName}/data-source`);
73+
navigate(`${baseUrl}/data-source`);
7274
},
73-
isSelected: useMatchSubpath("data-source"),
75+
isSelected: useMatchSubpath(`${baseUrl}/data-source`),
7476
},
7577
{
7678
name: entitiesLabel,
7779
id: htmlIdGenerator("entities")(),
7880
icon: <EuiIcon type={EntityIcon} />,
7981
onClick: () => {
80-
navigate(`${process.env.PUBLIC_URL || ""}/p/${projectName}/entity`);
82+
navigate(`${baseUrl}/entity`);
8183
},
82-
isSelected: useMatchSubpath("entity"),
84+
isSelected: useMatchSubpath(`${baseUrl}/entity`),
8385
},
8486
{
8587
name: featureViewsLabel,
8688
id: htmlIdGenerator("featureView")(),
8789
icon: <EuiIcon type={FeatureViewIcon} />,
8890
onClick: () => {
89-
navigate(`${process.env.PUBLIC_URL || ""}/p/${projectName}/feature-view`);
91+
navigate(`${baseUrl}/feature-view`);
9092
},
91-
isSelected: useMatchSubpath("feature-view"),
93+
isSelected: useMatchSubpath(`${baseUrl}/feature-view`),
9294
},
9395
{
9496
name: featureServicesLabel,
9597
id: htmlIdGenerator("featureService")(),
9698
icon: <EuiIcon type={FeatureServiceIcon} />,
9799
onClick: () => {
98-
navigate(`${process.env.PUBLIC_URL || ""}/p/${projectName}/feature-service`);
100+
navigate(`${baseUrl}/feature-service`);
99101
},
100-
isSelected: useMatchSubpath("feature-service"),
102+
isSelected: useMatchSubpath(`${baseUrl}/feature-service`),
101103
},
102104
{
103105
name: savedDatasetsLabel,
104106
id: htmlIdGenerator("savedDatasets")(),
105107
icon: <EuiIcon type={DatasetIcon} />,
106108
onClick: () => {
107-
navigate(`${process.env.PUBLIC_URL || ""}/p/${projectName}/data-set`);
109+
navigate(`${baseUrl}/data-set`);
108110
},
109-
isSelected: useMatchSubpath("data-set"),
111+
isSelected: useMatchSubpath(`${baseUrl}/data-set`),
110112
},
111113
],
112114
},

0 commit comments

Comments
 (0)