Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
a60879c
feat(studio): open dashboards and reports from Studio in the app's ed…
claude Nov 25, 2026
6ac8385
test(studio): pin the Studio opens in the app, the x back and the pho…
claude Nov 25, 2026
a0fc418
test(studio): install a confirm in the DOM that ships none; open the …
claude Nov 25, 2026
54b5cce
fix(i18n): regenerate the zh-Hant catalogue from its zh-Hans source
claude Nov 25, 2026
74520e5
fix(studio): drop the dead initial value eslint names
claude Nov 25, 2026
0a2eaf1
Merge remote-tracking branch 'origin/main' into claude/issue-36906-da…
claude Nov 25, 2026
d80d7da
fix(app-shell): a report made from Studio's list is saved in the pack…
claude Nov 25, 2026
2058c0d
test(app-shell): pin the report save package, the draft-only open, th…
claude Nov 25, 2026
116911f
docs(app-shell): say the changeset in user terms; the dashboard docs …
claude Nov 25, 2026
5ff1d38
Merge remote-tracking branch 'origin/main' into claude/issue-36906-da…
claude Nov 25, 2026
427168a
test(app-shell): pay the lint load at collection in the new-report pa…
claude Nov 25, 2026
08107d2
Merge remote-tracking branch 'origin/main' into claude/issue-36906-da…
claude Nov 25, 2026
ad67a64
Merge remote-tracking branch 'origin/main' into claude/issue-36906-da…
claude Nov 25, 2026
99b4f96
fix(app-shell): a report saved outside the app's package from Studio …
claude Nov 25, 2026
35c94a7
test(app-shell): the create-landing pin names the item directly; the …
claude Nov 25, 2026
298361b
Merge remote-tracking branch 'origin/main' into claude/issue-36906-da…
claude Nov 25, 2026
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
19 changes: 19 additions & 0 deletions .changeset/36906-studio-dashboard-report-app-edit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
'@object-ui/app-shell': patch
'@object-ui/i18n': patch
---

feat(app-shell): a dashboard or a report opened from a Studio list opens in its app's edit state, and × goes back to the list

Clause-②: no
Metadata-protocol: none

Studio redesign (epic #36890), decisions 3, 6, 13 and 15.

- **Opening a dashboard or a report from a Studio list** opens its page in an app, with the dashboard's edit state or the report's builder already open, as the page's own Edit opens them. The app is the one the author came from, when that app is one of the package's published apps or its menu opens the item; otherwise it is the package's first published app. The item keeps opening Studio's own item page when the package has no published app, on the list of every package, when the item has no published version yet (a draft only), or when the link asks for one of the item page's tabs or its draft review.
- **× back to Studio.** The page's address remembers the Studio list it was opened from, so the dashboard page and the report page draw a × that goes back to that list with its filters and sort, after a reload too. The report builder's own × does the same. Leaving unsaved edits asks first.
- **New report from Studio's report list** opens the app's New report page. The report is saved in the package the list shows, or, for an installed app, in its customization package, so it appears in the list × goes back to. Where the installed app's customization package cannot be used, New goes back to the list, as before. If that package becomes unusable between opening the page and saving, the report is saved outside any package, and a notice says the Studio list does not show it. Closing the page goes back to the Studio list, and the saved report's page keeps the way back. With no app to open, the list creates as before.
- **A dashboard made in Studio** opens in its app once saved, and the browser's Back from there goes to the list, not to an empty New page.
- **The report builder's ×, and the New report page's ×,** now ask before dropping unsaved edits everywhere, not only when Studio opened them.
- **No dashboard edit on a phone.** The dashboard edit state is no longer offered in a phone-width window (narrower than 640 px). A link that asks for it, from Studio or the design mode, is ignored there and the page stays a viewer. The Edit button was already hidden at that width.
- New console strings under `studioReturn`, and `report.builder.savedOutsideApp`, in every bundled locale.
19 changes: 18 additions & 1 deletion content/docs/frontend/plugins/plugin-dashboard.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,24 @@ The console's dashboard page uses both in its in-page edit state: an admin
who may design the dashboard's package opens it with **Edit**, changes it with
Studio's own dashboard panels at the right, and **Save** publishes that one
dashboard (into the package, or into the app's customization package for an
installed app), so everyone sees it at once.
installed app), so everyone sees it at once. The edit state needs its side
panel, so it is not offered on a window narrower than Tailwind's `sm`
breakpoint (640 px).

A dashboard opened from Studio's dashboard list lands on this page with the
edit state already open, in the app the author came from when it is one of
the package's apps (or its menu opens the dashboard), else in the package's
first published app. The page's address then carries `?studio=` with the
Studio list, and the header draws a **×** that goes back to it, after a
reload too. A report opened from Studio's report list lands the same way,
with its builder open, and the report list's **New** opens the app's
`reports/new` page, which saves the new report in the package (or, for an
installed app, in its customization package), so it is in the list the
**×** goes back to. If neither package can be used when the report is
saved, it is saved outside any package, and a notice says the Studio list
does not show it. A package with no published app, and a dashboard or a
report that has no published version yet (a draft only), keep Studio's
generic item page.

## TypeScript Support

Expand Down
3 changes: 2 additions & 1 deletion ui/packages/app-shell/src/layout/designModeArrival.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
* The landing of a dashboard the design mode just created (objectstack#36364):
* the design mode navigates to the new dashboard with this in the navigation
* state, and the dashboard's page opens its edit state on arrival
* (objectstack#36372), as its Edit button does.
* (objectstack#36372), as its Edit button does. A dashboard opened from a
* Studio list lands the same way (objectstack#36906, `StudioAreaAppOpen`).
*
* Navigation state, not a URL parameter: it is a one-time instruction, not a
* place anyone links to, so a shared or reloaded address never opens the edit
Expand Down
20 changes: 17 additions & 3 deletions ui/packages/app-shell/src/urlParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/

import { NAV_RUN_ACTION_PARAM } from '@object-ui/layout';
import { STUDIO_RETURN_PARAM } from './views/studio-design/studioAddress.js';

/**
* urlParams — the single registry of RESERVED console URL query params
Expand Down Expand Up @@ -61,6 +62,9 @@ import { NAV_RUN_ACTION_PARAM } from '@object-ui/layout';
* | `from` | Ancestor breadcrumb trail for a record route, | push (with |
* | | so drilling record→related-record keeps a | the drill-in) |
* | | clickable path back (`Account → #p → Invoice`).| |
* | `studio` | The Studio list an app page was opened from | with the |
* | | (objectstack#36906): the page draws × back to | Studio open |
* | | it. Defined by `studioAddress.ts`. | |
*
* Push-vs-replace rule of thumb: an overlay the user OPENED (form, drawer)
* pushes one entry so browser Back closes it; passive state that tracks an
Expand All @@ -71,9 +75,10 @@ import { NAV_RUN_ACTION_PARAM } from '@object-ui/layout';
* `package`, …) belong to their page's own contract and are NOT reserved
* here — but they must not collide with the names above.
*
* One reserved param is DEFINED ELSEWHERE and only re-exported here:
* `runAction` (see {@link NAV_RUN_ACTION_PARAM}). It is the wire encoding of a
* spec-declared nav slot, written by `@object-ui/layout`'s `resolveHref`, which
* Two reserved params are DEFINED ELSEWHERE and only re-exported here.
* `studio` ({@link STUDIO_RETURN_PARAM}) belongs to Studio's one address
* builder, `studioAddress.ts`. `runAction` (see {@link NAV_RUN_ACTION_PARAM})
* is the wire encoding of a spec-declared nav slot, written by `@object-ui/layout`'s `resolveHref`, which
* sits below this package — so the constant lives there and this registry
* references it rather than restating it. Restating would give the console's
* hottest collision check a second spelling to drift from, which is the exact
Expand Down Expand Up @@ -190,6 +195,14 @@ export const RECORD_TRAIL_PARAM = 'from';
*/
export { NAV_RUN_ACTION_PARAM };

/**
* The Studio address an app page returns to (`?studio=<address>`,
* objectstack#36906, epic #36890 decision 15). Re-exported, not restated:
* `studioAddress.ts` owns the Studio vocabulary and its builders
* (`withStudioReturn`, `readStudioReturn`); read it through them.
*/
export { STUDIO_RETURN_PARAM };

/**
* All reserved params, for collision checks (e.g. a lint or a dev-time
* assertion that a page-scoped param doesn't shadow the console contract).
Expand All @@ -208,6 +221,7 @@ export const RESERVED_URL_PARAMS: readonly string[] = [
KEYBOARD_SHORTCUTS_PARAM,
RECORD_TRAIL_PARAM,
NAV_RUN_ACTION_PARAM,
STUDIO_RETURN_PARAM,
];

/**
Expand Down
38 changes: 36 additions & 2 deletions ui/packages/app-shell/src/views/DashboardInPageEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -206,20 +206,54 @@ export function filtersSectionLabel(locale: SupportedLocale): string | null {
return typeof section?.label === 'string' ? section.label : null;
}

/**
* The narrowest window the edit state is offered in: Tailwind's `sm`, from
* which the page draws the side panel the edit state needs.
*/
export const DASHBOARD_EDIT_MIN_WIDTH = 640;

/** Is the window at least {@link DASHBOARD_EDIT_MIN_WIDTH} wide right now? */
function dashboardEditFitsNow(): boolean {
return typeof window === 'undefined' || window.innerWidth >= DASHBOARD_EDIT_MIN_WIDTH;
}

/**
* Whether the window is wide enough for the edit state (objectstack#36906).
* Read synchronously on the first render, as `usePhoneViewport` reads its
* answer, so a landing that asks for the edit state never sees a phone as wide.
*/
export function useDashboardEditFits(): boolean {
const [fits, setFits] = React.useState<boolean>(dashboardEditFitsNow);
React.useEffect(() => {
if (typeof window === 'undefined' || typeof window.matchMedia !== 'function') return;
const mql = window.matchMedia(`(min-width: ${DASHBOARD_EDIT_MIN_WIDTH}px)`);
const onChange = () => setFits(dashboardEditFitsNow());
mql.addEventListener('change', onChange);
// A width that moved between the first render and this effect.
onChange();
return () => mql.removeEventListener('change', onChange);
}, []);
return fits;
}

/**
* Whether this principal is offered the Edit button for a dashboard
* `ownerPackageId` owns: the gate of the app → Studio entries
* (`useStudioEntryGate`: a workspace admin who may author metadata, on a
* package Studio lists, writable or not; never a kernel package). A
* read-only package's dashboard is edited through its customization package.
* Not while the shell's design mode is on (objectstack#36692): the two are
* separate entries, never open together.
* separate entries, never open together. Not on a phone either
* (objectstack#36906): the edit state needs its side panel, so a window
* narrower than {@link DASHBOARD_EDIT_MIN_WIDTH} is offered no edit, and a
* landing that asks for one (from Studio, from the design mode) opens none.
*/
export function useDashboardEditOffered(ownerPackageId: string | null | undefined): boolean {
const path = ownerPackageId ? studioPackagePath(ownerPackageId) : null;
const gated = useStudioEntryGate(path) !== null;
const designing = useDesignModeActive();
return gated && !designing;
const fits = useDashboardEditFits();
return gated && !designing && fits;
}

/** The page header's Edit button. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ const packages = vi.hoisted(() => ({
ensured: [] as string[],
}));
/** objectstack#36364 — the navigation state the page is reached with, and its replaces. */
const route = vi.hoisted(() => ({ state: null as unknown, navigate: null as null | ((...a: unknown[]) => void) }));
const route = vi.hoisted(() => ({ state: null as unknown, search: '', navigate: null as null | ((...a: unknown[]) => void) }));
const toasts = vi.hoisted(() => ({ success: [] as unknown[], error: [] as unknown[] }));

vi.mock('../providers/MetadataProvider', () => ({ useMetadata: () => meta.value }));
vi.mock('react-router-dom', () => ({
useParams: () => ({ dashboardName: 'ops_board' }),
useNavigate: () => route.navigate ?? (() => {}),
useLocation: () => ({ pathname: '/apps/crm/dashboard/ops_board', search: '', hash: '', key: 'landing', state: route.state }),
useLocation: () => ({ pathname: '/apps/crm/dashboard/ops_board', search: route.search, hash: '', key: 'landing', state: route.state }),
}));
vi.mock('./useOpenRecordList', () => ({
useRecordListDrillNavigation: () => ({ openRecordList: vi.fn(), canOpenRecordList: () => true }),
Expand Down Expand Up @@ -187,6 +187,7 @@ beforeEach(() => {
toasts.success = [];
toasts.error = [];
route.state = null;
route.search = '';
route.navigate = null;
});

Expand Down Expand Up @@ -401,6 +402,90 @@ describe('DashboardView arrival from the design mode (objectstack#36364)', () =>
});
});

describe('DashboardView opened from a Studio list (objectstack#36906)', () => {
const studioList = '/studio/crm/metadata/dashboard?q=ops';
const fromStudio = `?studio=${encodeURIComponent(studioList)}`;

let widthBefore = 0;
beforeEach(() => {
widthBefore = window.innerWidth;
});
afterEach(() => {
Object.defineProperty(window, 'innerWidth', { configurable: true, writable: true, value: widthBefore });
});

it('lands in the edit state, and x goes back to the Studio list', async () => {
const navigate = vi.fn();
route.navigate = navigate;
route.state = { designModeNewDashboard: 'ops_board' };
route.search = fromStudio;
mount();
expect(await screen.findByTestId('dashboard-editing-badge')).toBeInTheDocument();
// The landing is cleared, and the address keeps the way back.
expect(navigate).toHaveBeenCalledWith(`/apps/crm/dashboard/ops_board${fromStudio}`, { replace: true, state: null });
const close = screen.getByTestId('studio-return');
expect(close).toHaveAttribute('data-target', studioList);
fireEvent.click(close);
expect(navigate).toHaveBeenLastCalledWith(studioList);
});

it('after a reload (no landing), the viewer still draws x back to the Studio list', async () => {
route.search = fromStudio;
mount();
await screen.findByTestId('dashboard-edit');
expect(screen.queryByTestId('dashboard-editing-badge')).not.toBeInTheDocument();
expect(screen.getByTestId('studio-return')).toHaveAttribute('data-target', studioList);
});

it('x over unsaved edits asks first, and staying keeps the edit state', async () => {
const navigate = vi.fn();
route.navigate = navigate;
route.search = fromStudio;
// This DOM ships no window.confirm: install one, and put back what was there.
const before = window.confirm;
const confirm = vi.fn(() => false);
window.confirm = confirm as unknown as typeof window.confirm;
try {
mount();
await openEdit();
fireEvent.keyDown(screen.getByTestId('dashboard-widget-resize-handle'), { key: 'ArrowRight' });
fireEvent.click(screen.getByTestId('studio-return'));
expect(confirm).toHaveBeenCalledTimes(1);
expect(navigate).not.toHaveBeenCalledWith(studioList);
expect(screen.getByTestId('dashboard-editing-badge')).toBeInTheDocument();
confirm.mockReturnValue(true);
fireEvent.click(screen.getByTestId('studio-return'));
expect(navigate).toHaveBeenLastCalledWith(studioList);
} finally {
window.confirm = before;
}
});

it('on a phone, the landing opens no edit state: it is cleared and the page stays a viewer', async () => {
Object.defineProperty(window, 'innerWidth', { configurable: true, writable: true, value: 390 });
const navigate = vi.fn();
route.navigate = navigate;
route.state = { designModeNewDashboard: 'ops_board' };
route.search = fromStudio;
mount();
await screen.findAllByText('Total (served)');
await act(async () => { await new Promise((r) => setTimeout(r, 0)); });
expect(navigate).toHaveBeenCalledWith(`/apps/crm/dashboard/ops_board${fromStudio}`, { replace: true, state: null });
expect(screen.queryByTestId('dashboard-editing-badge')).not.toBeInTheDocument();
expect(screen.queryByTestId('dashboard-edit')).not.toBeInTheDocument();
expect(client.value.layered).not.toHaveBeenCalled();
// The way back is still there.
expect(screen.getByTestId('studio-return')).toBeInTheDocument();
});

it('a ?studio= value that is not a Studio address draws no x', async () => {
route.search = `?studio=${encodeURIComponent('https://example.com/studio/crm')}`;
mount();
await screen.findByTestId('dashboard-edit');
expect(screen.queryByTestId('studio-return')).not.toBeInTheDocument();
});
});

describe('DashboardView with no cards yet (objectstack#36364)', () => {
it('a dashboard with no cards says so instead of drawing a blank page; one with cards does not', async () => {
mount({ name: 'ops_board', label: 'Payment analysis', _packageId: 'crm', widgets: [] });
Expand Down
22 changes: 18 additions & 4 deletions ui/packages/app-shell/src/views/DashboardView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@ import {
DashboardEditButton,
DashboardEditingBadge,
DashboardEditPanel,
useDashboardEditFits,
useDashboardEditOffered,
useDashboardInPageEdit,
} from './DashboardInPageEditor.js';
import { StudioReturnButton, useStudioReturnPath } from './StudioReturnButton.js';
import { useInSetupApp } from '../console/setupApp.js';
import { useCustomizeDoorWalled } from './studio-design/StudioCustomizeControls.js';
import { readDashboardEditArrival, withoutDashboardEditArrival } from '../layout/designModeArrival.js';
Expand Down Expand Up @@ -304,21 +306,29 @@ export function DashboardView({ dataSource }: { dataSource?: any }) {
// objectstack#36364 — a dashboard the design mode just created arrives with
// its page asked to open the edit state, once the Edit button is offered;
// the landing is cleared as it is read, so Back or a reload opens nothing.
// objectstack#36906 — a dashboard opened from a Studio list lands the same
// way. On a phone the edit state is never offered, so the landing is
// cleared there and the page stays a viewer.
const location = useLocation();
const navigate = useNavigate();
const editFits = useDashboardEditFits();
const arrivedToEdit = readDashboardEditArrival(location.state, dashboardName);
const landedRef = useRef<string | null>(null);
useEffect(() => {
if (!arrivedToEdit || !dashboard || !editOffered || editing) return;
if (!arrivedToEdit || !dashboard || editing) return;
if (!editOffered && editFits) return;
if (landedRef.current === location.key) return;
landedRef.current = location.key;
navigate(`${location.pathname}${location.search}${location.hash}`, {
replace: true,
state: withoutDashboardEditArrival(location.state),
});
void startEdit();
if (editOffered) void startEdit();
// eslint-disable-next-line react-hooks/exhaustive-deps -- runs once per landing; `startEdit` is a fresh closure each render
}, [arrivedToEdit, dashboard, editOffered, editing, location.key]);
}, [arrivedToEdit, dashboard, editOffered, editFits, editing, location.key]);
// objectstack#36906 — opened from a Studio list: × goes back to it.
const studioReturn = useStudioReturnPath();
const studioReturnButton = studioReturn ? <StudioReturnButton to={studioReturn} dirty={editing && edit.dirty} /> : null;

const previewSchema = useMemo(() => {
if (!dashboard || !unregistered) return dashboard;
Expand Down Expand Up @@ -456,14 +466,17 @@ export function DashboardView({ dataSource }: { dataSource?: any }) {
icon={<LayoutDashboard className="h-4 w-4" />}
badge={editing ? <DashboardEditingBadge /> : undefined}
actions={editing ? (
<div className="flex items-center gap-2">
<DashboardEditActions
onAddCard={edit.addCard}
onDiscard={edit.discard}
onSave={saveEdit}
saving={edit.saving}
dirty={edit.dirty}
/>
) : (refreshState || editOffered) && (
{studioReturnButton}
</div>
) : (refreshState || editOffered || studioReturnButton) && (
<div className="flex items-center gap-2">
{editOffered && <DashboardEditButton onClick={startEdit} busy={edit.opening} />}
{refreshState && (
Expand All @@ -480,6 +493,7 @@ export function DashboardView({ dataSource }: { dataSource?: any }) {
{refreshState.refreshing ? tt('dashboard.refreshing', 'Refreshing…') : tt('dashboard.refreshAll', 'Refresh All')}
</Button>
)}
{studioReturnButton}
</div>
)}
/>
Expand Down
6 changes: 3 additions & 3 deletions ui/packages/app-shell/src/views/ReportBuilderHost.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ export interface ReportBuilderHostProps {
servedText?: ServedReportText | null;
/** Write the report. `true` when it was saved; the host then closes the builder. */
onSave: (report: ReportDraft) => Promise<boolean>;
/** Leave the builder without saving. */
onClose: () => void;
/** Leave the builder without saving. `dirty`: the builder holds edits that leaving drops. */
onClose: (left: { dirty: boolean }) => void;
/** A notice above the preview (the pending-draft bar). */
banner?: React.ReactNode;
dataSource?: DataSource;
Expand Down Expand Up @@ -147,7 +147,7 @@ export function ReportBuilderHost({ initial, servedText, onSave, onClose, banner
}
onSave={handleSave}
onDiscard={() => setDraft(initial)}
onClose={onClose}
onClose={() => onClose({ dirty })}
dirty={dirty}
saving={saving}
banner={banner}
Expand Down
Loading
Loading