Skip to content

Commit 6090bb7

Browse files
fix(app-shell): a Studio selection unfolds a hidden right panel at every width (#26824)
<!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} --> _Requested by **Steedos** · [project thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbJb35KmECWS5ewFYWdLwfje)_ Fixes #26737 Clause-②: no Metadata-protocol: none ## 维护者速读 - **改了什么**:Studio 里右侧面板被隐藏时,选中一个元素(自动化里的流程节点、界面里的区块、数据里的字段)现在会把右侧面板展开,并直接显示该元素的属性。以前只有手机宽度会自动展开,桌面宽度下选中后配置哪里都不显示。 - **为什么改**:QA 实测 900×850 下隐藏右栏后点节点,没有抽屉也没有侧栏,用户必须重新找到右上角的切换按钮才能编辑选中的步骤。 - **风险与回滚**:低。只改了右栏宿主的 `showProps` 一处行为,不动任何元数据和 spec。注意它推翻了旧测试钉住的「隐藏的右栏在选中时保持隐藏」,三个设计面板一起生效。回滚即 revert 本 PR。 - **先看**:`StudioDesignSurface.tsx` 里 `showSlotProps` 的新定义;`StudioDesignSurface.pillarsClaimSlot-12725.test.tsx` 里替换掉的那条用例。 - **两分钟验证**:在 Studio 打开一个流程,点右上角图标隐藏右栏,再点任意节点,预期右栏展开并显示该节点的配置。 - **需要你做的**:无,席位落地。 ## What changes The Studio right slot's handle (`StudioRightSlotHandle`) documents `showProps` as "An element was selected: show its properties". The host implemented it as "switch the slot to properties, and open it only on a phone" (`if (isMobile) setSlotOpenMobile(true)`), so at a desktop width a selection made while the builder had hidden the panel set the mode and drew the properties nowhere. In Automations the classic folded-row drawer is the other path, and it is drawn only outside the slot (`configFolded && !inSlot`), so neither path showed the node's configuration. `showSlotProps` now unfolds the slot at every width, through the same `setSlotOpen` that the top-bar toggle and the slot shortcut use, so the shown state is remembered under the Studio key as a click on the toggle remembers it. On a phone nothing changes. The function is now held in `useState` for the surface's life, reading the latest `setSlotOpen` through a ref, instead of a `useCallback` keyed on `isMobile`. The three pillars that call it run their effect on the selection key and on this function. With the old memo, a re-created callback (a breakpoint change, or React discarding the memo, ui/AGENTS.md #10) re-ran those effects, and with this change that would reopen a panel the builder had just hidden over the same selection. Now a pillar asks again only on a new selection. ## Why A builder who hides the right panel on a mid-size screen could not edit the selected step without finding the toggle again (QA run studio-qa-2026-10-27, id U9). ## Tests - `StudioDesignSurface.pillarsClaimSlot-12725.test.tsx` (Automations): the case "a hidden slot stays hidden on a selection, as on Interfaces" is replaced. At a desktop width (no `md` match), the builder hides the slot from the toggle, selects a node, and the slot is visible in properties mode with that node's inspector, the toggle pressed and the Studio key `1`, with no drawer. A second case: hidden again over the same selection, the slot stays hidden, also when the same node is picked again, and another node unfolds it. - `StudioDesignSurface.rightSlot-12725.test.tsx` (Interfaces): hiding the slot and selecting a block unfolds it on the block's properties. - Ablation (one-off, not kept): with the fix committed, `node scripts/ablation-replace.mjs` deleted `setSlotOpenRef.current(true);` (anchor 1 → 0, blob `15f41dcf` → `dd54dbc7`). The two files ran red: Tests 3 failed, 25 passed (28), exactly the three new cases. Restored: blob equals HEAD, `git diff HEAD` empty. ## Acceptance notes - **This reverses a pinned behaviour.** objectui#12725 phase 2 pinned "a hidden slot stays hidden on a selection, as on Interfaces". The card, its triage and the claim ask for the opposite (a selection shows its configuration at every width), so this PR replaces that case rather than keeping both. The maintainer's words that header quotes for phase 2 (「属性好需要考虑选中每个元素的时候也要显示」) ask for properties to show on every selection. - **All three slot pillars change together.** The fix is in the slot host, not in the Automations pillar, so a block selected in Interfaces and a field selected in Data unfold a hidden panel too. A flow-only fix would need either a second handle method or a drawer inside the slot layout, and the slot layout deliberately draws no drawer (the pinned case "a row too narrow for the classic aside opens no drawer"). The classic layout's folded-row drawer is unchanged. - **The unfold is remembered**, as the toggle and the shortcut remember it: after a selection unfolds the panel, a reload shows it. ## Verification All readings at head `367db7d0` (base `c8583f80`), under `scripts/pm/os-verify-lock.sh`. <details><summary>Touched package: @object-ui/app-shell</summary> - Dependency closure and type-check: `pnpm exec turbo run type-check --filter=@object-ui/app-shell --concurrency=2`, 64 tasks successful, VERDICT command-exit 0. Re-run at `367db7d0`: `pnpm --filter @object-ui/app-shell type-check` (`tsc --noEmit` and `tsc -p tsconfig.test.json`), VERDICT command-exit 0. - The two touched test files: Test Files 2 passed (2), Tests 28 passed (28). - Narrowed app-shell run: every test file naming `StudioDesignSurface`, `useStudioRightSlot` or `StudioRightSlot` (169 files, `StudioDesignSurface.flowCanvasChip-11665` left out: seat 1 holds it on #26692): Test Files 169 passed (169), Tests 1333 passed (1333), VERDICT command-exit 0. The rest of app-shell is left to CI's Test UI shards. - ESLint with `ui/eslint.config.js` on the three touched files: 0 errors, and no warning on the changed lines. </details> <details><summary>Derived gates</summary> - `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack` derived 34 commands for the 4 changed paths; all 34 exit 0, each code captured before any pipe, among them `check:nul-bytes`, `check:test-source-alias`, `check:cross-package-test-inputs`, `check:type-check-coverage`, `check:type-check-debt`, `check-sdui-manifest`, `check-empty-changeset` and `check-changeset-no-major`. `pnpm --dir ui exec vitest run scripts/`: Test Files 178 passed, 2 skipped (180), Tests 5065 passed, 2 skipped. - `--ran` reconciled: "34 derived famil(ies) accounted for — 34 run, 0 NOT-MEASURED". `pnpm check:changeset-fixed` (roster under `.changeset`) also ran, exit 0. - `pnpm --dir ui run check:new-line-citations`: 0 new cross-file line-address citations. - Families CI runs over the whole tree (type-check lanes, lint, artifact rosters) are CI's; the PR's check-runs are the reading. </details> ## Human Minimum - [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic. (not touched) - [x] 2. Every name I added uses the casing for its kind. - [x] 3. No formatter ran; `pnpm lint` passes. (lint is CI's) - [x] 4. One issue, one branch off an up-to-date `main`, one pull request. - [x] 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset. - [x] 6. `packages/spec` touched: its generated artifacts are regenerated and committed. (not touched) - [x] 7. No hand edits to `content/docs/references/`, `packages/*/CHANGELOG.md` or `content/docs/releases/`. - [x] 8. Title, body and comments are in English. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01QsR2jRkRJ1Po9y5UgWCsns --- _Generated by [Claude Code](https://claude.ai/code/session_01QsR2jRkRJ1Po9y5UgWCsns)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent c4a4aef commit 6090bb7

4 files changed

Lines changed: 71 additions & 11 deletions

File tree

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
'@object-ui/app-shell': patch
3+
---
4+
5+
fix(app-shell): in Studio, selecting an element while the right panel is hidden unfolds the panel on its properties
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
With the right panel hidden from the top bar, selecting a flow node in Automations (or a block in Interfaces, or a field in Data) showed its configuration nowhere on a desktop-width screen: only a phone reopened the panel. A builder had to find the toggle again before they could edit the selected step.
11+
12+
What changes:
13+
14+
- A new selection now unfolds a hidden panel at every width, on the selected element's properties, the way `⌘.` unfolds it. The panel's shown state is remembered as when you show it from the toggle.
15+
- Hiding the panel again while the same element stays selected keeps it hidden. Only another selection unfolds it.
16+
17+
What to do: nothing. Nothing a flow, page or object declares changes.

‎ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.pillarsClaimSlot-12725.test.tsx‎

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
* returns it to the flow's Configuration. A row too narrow for the classic
1818
* aside opens no drawer (objectui#11795's fold is the classic layout's).
1919
* - While 属性 shows, the copilot strip stays at the slot's foot.
20-
* - A hidden slot stays hidden on a selection, as on Interfaces.
20+
* - A hidden slot unfolds on a new selection (objectstack#26737); hidden again
21+
* over the same selection, it stays hidden.
2122
* - CONTROL: the Access pillar claims nothing — the slot shows the copilot
2223
* alone; the Interfaces pillar's own pins live in `rightSlot-12725`.
2324
*
@@ -383,19 +384,39 @@ describe('Automations: the Configuration is in the right slot (objectui#12725)',
383384
}
384385
});
385386

386-
it('a hidden slot stays hidden on a selection, as on Interfaces', async () => {
387-
window.sessionStorage.setItem(DOCK_STUDIO_EXPANDED_STORAGE_KEY, '0');
387+
// objectstack#26737 — at a desktop width (no `md` match), a node selected
388+
// while the panel is hidden unfolds it on that node's configuration.
389+
it('a hidden slot unfolds on a selection, on the selected node’s configuration', async () => {
388390
await openFlow();
391+
fireEvent.click(screen.getByTestId('studio-slot-toggle'));
389392
expect(slot()).not.toBeVisible();
393+
expect(window.sessionStorage.getItem(DOCK_STUDIO_EXPANDED_STORAGE_KEY)).toBe('0');
390394

391395
fireEvent.click(screen.getByTestId('pick-node'));
392-
await act(async () => {});
393-
expect(slot()).not.toBeVisible();
396+
await waitFor(() => expect(slot()).toBeVisible());
397+
expect(slot()).toHaveAttribute('data-mode', 'props');
398+
expect(within(slotProps()).getByLabelText('Node start')).toBeVisible();
399+
expect(screen.getByTestId('studio-slot-toggle')).toHaveAttribute('aria-pressed', 'true');
400+
expect(window.sessionStorage.getItem(DOCK_STUDIO_EXPANDED_STORAGE_KEY)).toBe('1');
394401
expect(screen.queryByTestId('auto-config-drawer')).toBeNull();
395-
// Shown again, it opens on the selection's properties.
402+
});
403+
404+
it('hidden again over the same selection, it stays hidden until another node is selected', async () => {
405+
await openFlow();
406+
fireEvent.click(screen.getByTestId('pick-node'));
407+
await waitFor(() => expect(within(slotProps()).getByTestId('stub-flow-inspector')).toBeVisible());
408+
396409
fireEvent.click(screen.getByTestId('studio-slot-toggle'));
397-
expect(slot()).toHaveAttribute('data-mode', 'props');
398-
expect(within(slotProps()).getByTestId('stub-flow-inspector')).toBeVisible();
410+
await act(async () => {});
411+
expect(slot()).not.toBeVisible();
412+
// The same node again is no new selection.
413+
fireEvent.click(screen.getByTestId('pick-node'));
414+
await act(async () => {});
415+
expect(slot()).not.toBeVisible();
416+
417+
fireEvent.click(screen.getByTestId('pick-other-node'));
418+
await waitFor(() => expect(slot()).toBeVisible());
419+
expect(within(slotProps()).getByLabelText('Node end')).toBeVisible();
399420
});
400421
});
401422

‎ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.rightSlot-12725.test.tsx‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,19 @@ describe('Studio right slot: properties OR the copilot (objectui#12725)', () =>
267267
expect(window.sessionStorage.getItem(DOCK_STUDIO_EXPANDED_STORAGE_KEY)).toBe('1');
268268
});
269269

270+
// objectstack#26737 — a selection is never drawn nowhere: at a desktop width
271+
// it unfolds a hidden slot on the selected block's properties.
272+
it('selecting a block while the slot is hidden unfolds it on the properties', async () => {
273+
await openDashboard();
274+
fireEvent.click(screen.getByTestId('studio-slot-toggle'));
275+
expect(slot()).not.toBeVisible();
276+
277+
fireEvent.click(screen.getByTestId('pick-block'));
278+
await waitFor(() => expect(slot()).toBeVisible());
279+
expect(slot()).toHaveAttribute('data-mode', 'props');
280+
expect(within(slotProps()).getByTestId('stub-inspector')).toBeVisible();
281+
});
282+
270283
it('the copilot tab and strip mark a plan that awaits approval', async () => {
271284
copilot.planPending = true;
272285
await openDashboard();

‎ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx‎

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1807,10 +1807,19 @@ export function StudioDesignSurface({ aiSlot }: StudioDesignSurfaceProps): React
18071807
setSlotPropsClaims((n) => n + 1);
18081808
return () => setSlotPropsClaims((n) => n - 1);
18091809
}, []);
1810-
const showSlotProps = React.useCallback(() => {
1810+
// objectstack#26737 — a selection shows its properties at every width: a
1811+
// hidden slot unfolds, as `⌘.` unfolds it, so a builder who hid the panel is
1812+
// never left with a selection whose properties are drawn nowhere. One
1813+
// function for the surface's life (state, not a memo — AGENTS.md #10): the
1814+
// pillars ask on a new selection only, never because this was re-created.
1815+
const setSlotOpenRef = React.useRef(setSlotOpen);
1816+
React.useLayoutEffect(() => {
1817+
setSlotOpenRef.current = setSlotOpen;
1818+
});
1819+
const [showSlotProps] = React.useState(() => () => {
18111820
setSlotMode('props');
1812-
if (isMobile) setSlotOpenMobile(true);
1813-
}, [isMobile]);
1821+
setSlotOpenRef.current(true);
1822+
});
18141823
const slotHandle = React.useMemo<StudioRightSlotHandle | null>(
18151824
() =>
18161825
slotHost

0 commit comments

Comments
 (0)