Skip to content

Commit a571911

Browse files
xuyushun441-sysos-zhuangclaude
authored
fix(home): link into apps by package-id route segment (ADR-0048) (#1717)
The console home page still built /apps/<app.name> for the app grid (HomePage) and the favorite href (AppCard), while the nav (sidebar/switcher/command-palette) emits /apps/<packageId> via appRouteSegment since #1696. So opening an app from home produced a name-form URL (/apps/studio) instead of the canonical /apps/com.objectstack.studio. Both now use appRouteSegment(app). Verified in the browser (dev console against a live backend): clicking the Studio card → /apps/com.objectstack.studio; HotCRM card → /apps/app.objectstack.hotcrm/dashboard/executive_dashboard and the app renders. Co-authored-by: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 7ba9277 commit a571911

3 files changed

Lines changed: 17 additions & 3 deletions

File tree

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
"@object-ui/app-shell": patch
3+
---
4+
5+
ADR-0048: the console **home** page now links into apps by their canonical
6+
package-id route segment, matching the nav. The app grid (`HomePage`) and the
7+
"add to favorites" href (`AppCard`) were still building `/apps/<app.name>` while
8+
the sidebar/switcher/command-palette emit `/apps/<packageId>` (via
9+
`appRouteSegment`). So opening an app from the home page produced a name-form URL
10+
(e.g. `/apps/studio`) instead of `/apps/com.objectstack.studio`. Both now use
11+
`appRouteSegment(app)`.

packages/app-shell/src/console/home/AppCard.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import { Star, StarOff, ArrowUpRight } from 'lucide-react';
1010
import { Card, CardContent, Button, Badge } from '@object-ui/components';
1111
import { useObjectTranslation, useObjectLabel } from '@object-ui/i18n';
12-
import { resolveI18nLabel } from '../../utils';
12+
import { resolveI18nLabel, appRouteSegment } from '../../utils';
1313
import { useFavorites } from '../../hooks/useFavorites';
1414
import { getIcon } from '../../utils/getIcon';
1515
import { cn } from '@object-ui/components';
@@ -53,7 +53,9 @@ export function AppCard({ app, onClick, isFavorite, index = 0 }: AppCardProps) {
5353
toggleFavorite({
5454
id: `app:${app.name}`,
5555
label,
56-
href: `/apps/${app.name}`,
56+
// ADR-0048 — link to the canonical package-id route segment, not the
57+
// app name, so the favorite opens `/apps/<packageId>` like the nav does.
58+
href: `/apps/${appRouteSegment(app) ?? app.name}`,
5759
type: 'object',
5860
});
5961
};

packages/app-shell/src/console/home/HomePage.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import { useAuth, useIsWorkspaceAdmin } from '@object-ui/auth';
2626
import { AppCard } from './AppCard';
2727
import { RecentApps } from './RecentApps';
2828
import { StarredApps } from './StarredApps';
29+
import { appRouteSegment } from '../../utils';
2930
import { Empty, EmptyTitle, EmptyDescription, Button } from '@object-ui/components';
3031
import { Sparkles, Star, Clock, ArrowDown, Store, LayoutGrid, ShieldAlert, X, UploadCloud } from 'lucide-react';
3132
import { useMetadataClient } from '../../views/metadata-admin/useMetadata';
@@ -406,7 +407,7 @@ export function HomePage() {
406407
key={app.name}
407408
app={app}
408409
index={idx}
409-
onClick={() => navigate(`/apps/${app.name}`)}
410+
onClick={() => navigate(`/apps/${appRouteSegment(app) ?? app.name}`)}
410411
isFavorite={favorites.some(f => f.id === `app:${app.name}`)}
411412
/>
412413
))}

0 commit comments

Comments
 (0)