Skip to content

Commit ecbe0f6

Browse files
committed
fix(app-shell): a new report's menu entry carries the report's name
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JQwxbXq2Dxb31zZNmSqCtz
1 parent f302122 commit ecbe0f6

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

‎ui/packages/app-shell/src/layout/DesignModeMenu.tsx‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,10 @@ export default function DesignModeMenu({ app, basePath, resolveTargetLabel, reso
433433
const [buildingReport, setBuildingReport] = React.useState(false);
434434
const saveNewReport = async (name: string, label: string, body: Record<string, unknown>): Promise<boolean> => {
435435
if (!addAt) return false;
436-
const entry = entryFor('report', name, newEntryId([...menu, ...(storedMenu ?? [])]));
436+
// A report entry with no label shows its machine name (only an object,
437+
// view or dashboard entry inherits its target's label), so the entry
438+
// carries the name the reader gave the report.
439+
const entry = { ...entryFor('report', name, newEntryId([...menu, ...(storedMenu ?? [])])), label };
437440
const itemTexts = {
438441
...texts,
439442
itemPendingDraft: t('designMode.menu.newItemPendingDraft', {

‎ui/packages/app-shell/src/layout/__tests__/DesignModeMenu-36363.test.tsx‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,9 @@ describe('a new report from 「Add menu item」 (objectstack#36364, report half)
859859
expect(written[0][4]).toEqual({ mode: 'draft', ifNoneMatch: '*', packageId: 'com.acme.crm' });
860860
const navigation = (written[2][3] as { navigation: Array<{ id: string; children?: unknown[] }> }).navigation;
861861
expect(navigation[1].children!.map((c) => (c as { id: string }).id)).toEqual(['accounts', 'leads']);
862-
expect(navigation[2].children).toEqual([{ id: 'nav_item_1', type: 'report', reportName: 'payment_analysis' }]);
862+
expect(navigation[2].children).toEqual([
863+
{ id: 'nav_item_1', type: 'report', reportName: 'payment_analysis', label: 'Payment analysis' },
864+
]);
863865
expect(screen.queryByTestId('design-mode-bar')).toBeNull();
864866
expect(newReportSlotFor('/apps/crm/reports/new')).toBeNull();
865867
});

0 commit comments

Comments
 (0)