Skip to content

Commit 00e7735

Browse files
os-zhuangclaude
andauthored
fix(studio): label the Form sub-modes' data source — draft vs published (#2167)
预览 renders the PUBLISHED definition on purpose (structural draft changes have no physical columns until publish), but the UI never said so — after arranging a draft in 布局, switching to 预览 silently showed the old shape, reading as "changes lost". Captions now state the source (布局 = 草稿 · 含未发布改动 / 预览 = 已发布定义; the view-level badge follows the sub-mode), and with unpublished changes the preview shows an amber note pointing to 布局 for draft confirmation and the top-bar 发布 for the post-publish effect. Publishing stays a deliberate user action. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 2d785c8 commit 00e7735

2 files changed

Lines changed: 33 additions & 2 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(studio): say what the Form preview shows — published definition, not the draft
6+
7+
The Data pillar's Form view has two sub-modes: **布局** (the WYSIWYG layout designer,
8+
rendered from the draft) and **预览** (the live runtime ObjectForm). The preview
9+
renders the **published** definition on purpose — a draft with structural changes has
10+
no physical columns yet (DDL lands at publish), so a draft-with-data preview would
11+
break — but the UI never said so: after arranging a draft in 布局, switching to 预览
12+
silently showed the old shape, reading as "my changes are lost".
13+
14+
Now the sub-mode captions state their source (布局 = 草稿 · 含未发布改动 / 预览 =
15+
已发布定义), and when unpublished changes exist the preview shows an amber note:
16+
confirm the draft in 布局, or publish (top bar) first to see the published effect.
17+
Publishing stays a deliberate user action — nothing auto-publishes.

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

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -978,7 +978,12 @@ function DataPillar({
978978
</button>
979979
</div>
980980
<span className="inline-flex items-center gap-1 rounded-full bg-primary/10 px-2 py-0.5 text-[11px] text-primary">
981-
<Eye className="h-3 w-3" /> {viewMode === 'grid' ? '运行态列表 · 同一渲染器' : '运行态表单 · 同一渲染器'}
981+
<Eye className="h-3 w-3" />{' '}
982+
{viewMode === 'grid'
983+
? '运行态列表 · 同一渲染器'
984+
: formMode === 'layout'
985+
? '表单设计 · 草稿'
986+
: '运行态表单 · 已发布定义'}
982987
</span>
983988
<button
984989
type="button"
@@ -1072,8 +1077,17 @@ function DataPillar({
10721077
</button>
10731078
</div>
10741079
<span className="text-[11px] text-muted-foreground">
1075-
{formMode === 'layout' ? '布局设计器 · 分组与排序' : '运行态表单 · 同一渲染器'}
1080+
{formMode === 'layout' ? '布局设计器 · 草稿(含未发布改动)' : '运行态表单 · 已发布定义'}
10761081
</span>
1082+
{/* Preview renders the PUBLISHED definition on purpose: a draft with
1083+
* structural changes has no physical columns yet (DDL lands at
1084+
* publish), so a draft-with-data preview would break. Publishing is
1085+
* a deliberate user action — say so instead of silently lying. */}
1086+
{formMode === 'preview' && (dirty || hasDraft) && (
1087+
<span className="inline-flex items-center gap-1 rounded bg-amber-400/15 px-2 py-0.5 text-[11px] text-amber-600 dark:text-amber-300">
1088+
有未发布改动 — 此预览为发布前(已发布)的效果;草稿确认用「布局」,看发布后效果请先点顶栏「发布」
1089+
</span>
1090+
)}
10771091
</div>
10781092
{formMode === 'layout' ? (
10791093
<ObjectFormDesigner

0 commit comments

Comments
 (0)