Skip to content

Commit a436d40

Browse files
Copilothotlong
andcommitted
fix: propagate viewName in console href generation (App, Sidebar, Search)
Three additional places in the console app built object navigation hrefs without considering viewName: - findFirstRoute() in App.tsx (home redirect) - Mobile bottom nav in AppSidebar.tsx - SearchResultsPage.tsx search results All now append /view/{viewName} when present, matching the layout fix. Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent bd9d8fc commit a436d40

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

apps/console/src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ export function AppContent() {
427427
function findFirstRoute(items: any[]): string {
428428
if (!items || items.length === 0) return '';
429429
for (const item of items) {
430-
if (item.type === 'object') return `${item.objectName}`;
430+
if (item.type === 'object') return item.viewName ? `${item.objectName}/view/${item.viewName}` : `${item.objectName}`;
431431
if (item.type === 'page') return item.pageName ? `page/${item.pageName}` : '';
432432
if (item.type === 'dashboard') return item.dashboardName ? `dashboard/${item.dashboardName}` : '';
433433
if (item.type === 'url') continue; // Skip external URLs

apps/console/src/components/AppSidebar.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,10 @@ export function AppSidebar({ activeAppName, onAppChange }: { activeAppName: stri
524524
const NavIcon = getIcon(item.icon);
525525
const baseUrl = `/apps/${activeAppName}`;
526526
let href = '#';
527-
if (item.type === 'object') href = `${baseUrl}/${item.objectName}`;
527+
if (item.type === 'object') {
528+
href = `${baseUrl}/${item.objectName}`;
529+
if (item.viewName) href += `/view/${item.viewName}`;
530+
}
528531
else if (item.type === 'dashboard') href = item.dashboardName ? `${baseUrl}/dashboard/${item.dashboardName}` : '#';
529532
else if (item.type === 'page') href = item.pageName ? `${baseUrl}/page/${item.pageName}` : '#';
530533
return (

apps/console/src/components/SearchResultsPage.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,10 @@ export function SearchResultsPage() {
7777
const navItems = flattenNavigation(activeApp.navigation || []);
7878
return navItems.map((item: any) => {
7979
let href = '#';
80-
if (item.type === 'object') href = `${baseUrl}/${item.objectName}`;
80+
if (item.type === 'object') {
81+
href = `${baseUrl}/${item.objectName}`;
82+
if (item.viewName) href += `/view/${item.viewName}`;
83+
}
8184
else if (item.type === 'dashboard') href = `${baseUrl}/dashboard/${item.dashboardName}`;
8285
else if (item.type === 'page') href = `${baseUrl}/page/${item.pageName}`;
8386
else if (item.type === 'report') href = `${baseUrl}/report/${item.reportName}`;

0 commit comments

Comments
 (0)