Skip to content

Commit 34fe96f

Browse files
fix(studio): removing a field that holds data asks before the Data pillar saves it (#35617)
<!-- claude-projects-attribution: {"github_login":"os-sales"} --> _Requested by **Sales** · [project thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuFHC3CpgeSgxYniLbe7jSsx)_ Fixes #34931 Clause-②: no Metadata-protocol: none Signature: repo:objectstack#1 · os-sales · session_01L6bhgUgZpbKcVYFC7iXgMu ## 维护者速读 - 用户能看到什么变化:平台管理员在 Studio 数据栏删除一个已发布且存有数据的字段时,不再只看到「更改未保存」,而是弹出确认框列出会丢失的数据,可选择强制保存或取消并找回该字段。 - 为什么做:属于「控制台核心业务操作体验」专题中的应用与 Studio 往返一项,让管理员能在 Studio 里把删字段这件事做完。 - 出错会怎样:最坏情况是确认框里强制保存把该字段的数据列变为不可访问(与其他编辑器的强制保存相同);改动只在界面层,可直接撤回。 - 要你做什么:无 ## What changes The Data pillar's object draft save (`DataPillar` in `StudioDesignSurface.tsx`) now tells the door's `409 DESTRUCTIVE_CHANGE` apart from every other refusal, by status and code (`destructiveFindings` in `metadataError.ts`, which reads the client's parsed `issues`). - **The refusal opens a confirmation** instead of the generic strip. It lists the refusal's findings in the server's own words, under the existing `engine.edit.destructiveTitle` / `engine.edit.destructiveDesc` strings, with **Force save** (`engine.edit.forceSave`) and **Cancel** (`engine.cancel`). No locale key is added. - **Force save re-sends the refused save whole**: the same body, to the same object name and the same `packageId` the refused save wrote, with `force: true` (`?force=true` on the draft door). The address is held with the refusal, never re-derived, per the in-tree rule "The pair a write names is the door's answer". It goes through the same draft-version guard, so the `If-Match` pin still applies, and lands through the same success path as an ordinary autosave (dirty cleared only if the buffer did not move, verdict re-read, draft-saved toast). - **Cancel keeps the field**: each field a finding names goes back into the buffer as the server holds it (as loaded, or as last saved), at its old position. If the buffer is then what the server stores, it is clean and nothing is sent. If other edits are still pending, the autosave sends those edits, without the removal. - **While the confirmation is open the autosave is blocked** (`destructive !== null` in its `blocked` guard), so a refused removal is never re-sent behind another edit. The confirm cannot loop: the hook never re-sends a snapshot it already attempted, a forced save that is refused again goes to the strip, and a load of another object clears the held refusal. - The column-reorder save, which sends the same buffer, routes the same refusal to the same confirmation. Every other refusal goes through `objectSaveRefusal` exactly as before. ## Tests New `DataPillar.destructiveChange-34931.test.tsx`, on a real `MetadataClient` over a fetch double, so the URL each PUT left with is the one the door reads. The field is removed through the field inspector's header menu and its confirm, the way an author removes it. - the 409 opens the confirm listing the finding's text, and no refusal strip; Force save sends a second PUT with the same path, `force=true`, `package=com.example.showcase`, `mode=draft` and a byte-equal body, and the field stays removed; - Cancel puts the field back on the Form canvas and sends nothing more (2.3 s past the debounce, still one PUT); - a 422 `INVALID_METADATA` refusal still shows the refusal strip and no confirm. <details><summary>Readings at 52a0afb</summary> - `pnpm --dir ui exec vitest run packages/app-shell/src/views/studio-design/DataPillar.destructiveChange-34931.test.tsx`: Test Files 1 passed (1), Tests 3 passed (3). - Ablation (the two source files restored to `e35cf035`, test kept, restored afterwards byte-identical by blob hash): Tests 2 failed, 1 passed (3). The Force save and Cancel cases go red; the other-refusal case stays green, as it pins unchanged behaviour. - Neighbouring suites (`DataPillar.*`, `metadataError.*`, `StudioDesignSurface.*` under `ui/`, at 887bbda, before the test-only lint import): Test Files 177 passed (177), Tests 1307 passed (1307). - `pnpm --filter @object-ui/app-shell type-check` (both tsconfigs): exit 0. - `node scripts/pm/dispatch-gates.mjs --commands`: 39 derived commands, all run locally, all exit 0; `--ran` reconciliation: 39 run, 0 NOT-MEASURED. `check:test-source-alias` first went red on the new test (it reaches a dynamic `@objectstack/lint` import), and is green after a module-top import in the test. - `ui` `check:new-line-citations`: 0 new citations. `overlap-check`: merges cleanly with `origin/main`, 0 open PR heads share a file. </details> ## Acceptance notes - The finding list shows the server's English prose in every locale, as `ResourceEditPage` and `PermissionMatrixEditor` already do. - Not extracted: the destructive confirm now exists in four places (`ResourceEditPage`, `PermissionMatrixEditor`, `PackageOwdOverviewPanel`, here). A shared dialog was out of scope for this card. - Browser verification in a booted example app is recorded in the dev report comment on the card, not here: the pull request opens before that run. - Line budget: the diff is about 290 changed lines including the test, above the 200-line target. The extra lines are the dialog markup and the Cancel restore. ## Verification Read first, by risk: 1. `StudioDesignSurface.tsx`, `keepDestructive`: the Cancel restore and its dirty judgement. 2. `StudioDesignSurface.tsx`, `doSave`: the `forced` argument, which must address exactly what the refused save did. 3. `metadataError.ts`, `destructiveFindings`. Two-minute check: run the new test file (command above). Expect 3 passed. --- _Generated by [Claude Code](https://claude.ai/code/session_01L6bhgUgZpbKcVYFC7iXgMu)_ <!-- signed: repo:objectstack#1 · os-sales · session_01L6bhgUgZpbKcVYFC7iXgMu --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent ae2a67d commit 34fe96f

4 files changed

Lines changed: 286 additions & 11 deletions

File tree

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
'@object-ui/app-shell': patch
3+
---
4+
5+
fix(studio): removing a field that holds data asks before the Data pillar saves it
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
In Studio's Data pillar, removing a stored field from a published object (or retyping or requiring one) made the draft autosave answer `409 DESTRUCTIVE_CHANGE`, and the pillar showed only its generic "changes not saved" strip, with no way to finish the change. The refusal now opens a confirmation that lists what the save would lose, in the server's own findings. **Force save** sends the same body to the same object and package again with `force`; **Cancel** puts each field the findings name back as the server holds it and sends nothing more. While the confirmation is open the autosave sends nothing. Every other refusal reads on the strip as before.
11+
12+
The confirmation reuses the existing `engine.edit.destructiveTitle`, `engine.edit.destructiveDesc`, `engine.edit.forceSave` and `engine.cancel` strings: no locale key, prop or export changes.
Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
2+
3+
/**
4+
* objectstack#34931 — the object draft save the door refuses `409
5+
* DESTRUCTIVE_CHANGE` (a removed field holds data) asks the author: the
6+
* confirm names what would be lost; Force save sends the same body to the same
7+
* address with `?force=true`; Cancel puts the field back and sends nothing.
8+
* Any other refusal still reads on the pillar's refusal strip.
9+
*
10+
* The client is a real `MetadataClient`: only the transport is a double, so
11+
* the URL each PUT left with is what the door would read.
12+
*/
13+
14+
import '@testing-library/jest-dom/vitest';
15+
import * as React from 'react';
16+
import { afterEach, describe, expect, it, vi } from 'vitest';
17+
import { render, screen, fireEvent, cleanup, waitFor, within } from '@testing-library/react';
18+
import { MemoryRouter } from 'react-router-dom';
19+
import { MetadataClient } from '@object-ui/data-objectstack';
20+
21+
const objectDef = {
22+
name: 'showcase_task',
23+
label: 'Task',
24+
fields: [
25+
{ name: 'title', label: 'Title', type: 'text' },
26+
{ name: 'place', label: 'Place', type: 'text' },
27+
],
28+
};
29+
const LOST = "Field 'place' removed — existing data in this column will become inaccessible.";
30+
31+
const json = (status: number, body: unknown) =>
32+
new Response(JSON.stringify(body), { status, headers: { 'content-type': 'application/json' } });
33+
const refused = (status: number, code: string, message: string) =>
34+
json(status, { success: false, error: { message, code, details: { code, issues: [{ code: 'x', field: 'place', message }] } } });
35+
36+
const puts: Array<{ url: string; body: { fields: Array<{ name: string }> } }> = [];
37+
let answers: Response[] = [];
38+
const fetchImpl = vi.fn(async (url: string, init?: RequestInit) => {
39+
if (init?.method !== 'PUT') return json(404, null);
40+
puts.push({ url, body: JSON.parse(String(init.body)) });
41+
return answers.shift() ?? json(200, { success: true });
42+
});
43+
44+
const client = new MetadataClient({ baseUrl: 'http://test.local', fetch: fetchImpl as unknown as typeof fetch });
45+
Object.assign(client, {
46+
list: vi.fn(async () => [{ name: 'showcase_task', label: 'Task' }]),
47+
listDrafts: vi.fn(async () => []),
48+
layered: vi.fn(async () => ({ effective: objectDef, code: objectDef })),
49+
getDraft: vi.fn(async () => null),
50+
});
51+
52+
vi.mock('../metadata-admin/useMetadata', async (importOriginal) => {
53+
const mod = await importOriginal<typeof import('../metadata-admin/useMetadata')>();
54+
return { ...mod, useMetadataClient: () => client, useMetadataTypes: () => ({ entries: [] }) };
55+
});
56+
vi.mock('./packages-io', async (importOriginal) => {
57+
const mod = await importOriginal<typeof import('./packages-io')>();
58+
return { ...mod, fetchPackages: vi.fn(async () => []) };
59+
});
60+
// The field header's ⋯ menu as plain buttons (as in `DataPillar.celGate.test.tsx`).
61+
vi.mock('@object-ui/components', async (importOriginal) => {
62+
const mod = await importOriginal<typeof import('@object-ui/components')>();
63+
const Pass = (p: { children?: React.ReactNode }) => <div>{p.children}</div>;
64+
const Item = (p: { children?: React.ReactNode; onSelect?: () => void }) => (
65+
<button type="button" onClick={() => p.onSelect?.()}>{p.children}</button>
66+
);
67+
return {
68+
...mod,
69+
DropdownMenu: Pass,
70+
DropdownMenuTrigger: Pass,
71+
DropdownMenuContent: Pass,
72+
DropdownMenuItem: Item,
73+
DropdownMenuRadioGroup: Pass,
74+
DropdownMenuRadioItem: Item,
75+
};
76+
});
77+
vi.mock('@object-ui/react', async (importOriginal) => {
78+
const mod = await importOriginal<typeof import('@object-ui/react')>();
79+
return { ...mod, useAdapter: () => dataSource };
80+
});
81+
82+
import { DataPillar } from './StudioDesignSurface';
83+
import { createEmptyDataSource } from './__tests__/emptyDataSource';
84+
import { registerBuiltinInspectors } from '../metadata-admin/inspectors';
85+
// The source reaches a dynamic import of it: its first load is paid at collection (`check:test-source-alias`).
86+
import '@objectstack/lint';
87+
88+
const dataSource = createEmptyDataSource();
89+
registerBuiltinInspectors();
90+
91+
afterEach(() => {
92+
cleanup();
93+
puts.length = 0;
94+
answers = [];
95+
});
96+
97+
const card = (label: string) => screen.queryByText(label)?.closest('.cursor-grab') ?? null;
98+
const fieldNames = (i: number) => puts[i].body.fields.map((f) => f.name);
99+
100+
/** Open the Form tab, remove Place, and let the autosave send it. */
101+
async function removePlace(first: Response) {
102+
answers = [first];
103+
render(
104+
<MemoryRouter initialEntries={['/studio/com.example.showcase/data']}>
105+
<DataPillar packageId="com.example.showcase" />
106+
</MemoryRouter>,
107+
);
108+
fireEvent.click(await screen.findByRole('button', { name: 'Form' }));
109+
fireEvent.click((await screen.findByText('Place')).closest('.cursor-grab') as HTMLElement);
110+
fireEvent.click(await screen.findByRole('button', { name: 'Remove “Place”' }));
111+
fireEvent.click(within(await screen.findByRole('alertdialog')).getByTestId('field-remove-confirm-action'));
112+
await waitFor(() => expect(puts).toHaveLength(1), { timeout: 4000 });
113+
expect(fieldNames(0)).toEqual(['title']);
114+
}
115+
116+
describe('Data pillar — a destructive object draft save is confirmed, not dead-ended (objectstack#34931)', () => {
117+
it('names what would be lost; Force save re-sends the same body forced to the same package', async () => {
118+
await removePlace(refused(409, 'DESTRUCTIVE_CHANGE', LOST));
119+
const confirm = await screen.findByTestId('object-destructive-confirm');
120+
expect(confirm).toHaveTextContent(LOST);
121+
expect(screen.queryByTestId('studio-refusal')).toBeNull();
122+
123+
fireEvent.click(within(confirm).getByTestId('object-destructive-force'));
124+
await waitFor(() => expect(puts).toHaveLength(2), { timeout: 4000 });
125+
const [first, forced] = puts.map((p) => new URL(p.url));
126+
expect(forced.pathname).toBe(first.pathname);
127+
expect(forced.searchParams.get('force')).toBe('true');
128+
expect(forced.searchParams.get('package')).toBe('com.example.showcase');
129+
expect(forced.searchParams.get('mode')).toBe('draft');
130+
expect(first.searchParams.get('force')).toBeNull();
131+
expect(puts[1].body).toEqual(puts[0].body);
132+
await waitFor(() => expect(screen.queryByTestId('object-destructive-confirm')).toBeNull());
133+
expect(card('Place')).toBeNull();
134+
});
135+
136+
it('Cancel puts the field back and sends nothing more', async () => {
137+
await removePlace(refused(409, 'DESTRUCTIVE_CHANGE', LOST));
138+
fireEvent.click(within(await screen.findByTestId('object-destructive-confirm')).getByTestId('object-destructive-keep'));
139+
await waitFor(() => expect(card('Place')).not.toBeNull());
140+
await new Promise((r) => setTimeout(r, 2300));
141+
expect(puts).toHaveLength(1);
142+
expect(screen.queryByTestId('object-destructive-confirm')).toBeNull();
143+
});
144+
145+
it('any other refusal reads on the refusal strip, with no confirm', async () => {
146+
await removePlace(refused(422, 'INVALID_METADATA', 'Field place is invalid'));
147+
expect(await screen.findByTestId('studio-refusal')).toBeInTheDocument();
148+
expect(screen.queryByTestId('object-destructive-confirm')).toBeNull();
149+
await new Promise((r) => setTimeout(r, 2300));
150+
expect(puts).toHaveLength(1);
151+
});
152+
});

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

Lines changed: 108 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,12 @@ import {
169169
useShowInputFocus,
170170
} from './StudioPillarKit.js';
171171
import {
172+
AlertDialog,
173+
AlertDialogContent,
174+
AlertDialogDescription,
175+
AlertDialogFooter,
176+
AlertDialogHeader,
177+
AlertDialogTitle,
172178
GridFieldAuthoringProvider,
173179
cn,
174180
useIsMobile,
@@ -316,6 +322,7 @@ import {
316322
BATCH_ABORTED_CODE,
317323
causalPublishFailures,
318324
dashboardHeldEdit,
325+
destructiveFindings,
319326
flowHeldEdit,
320327
flowSaveRefusal,
321328
issueRefusal,
@@ -397,7 +404,7 @@ import {
397404
} from '../metadata-admin/previews/FlowPreview.js';
398405
import { InspectorShellHostProvider } from '../metadata-admin/inspectors/_shared.js';
399406
import { useFlowLabelOf, useFlowLabelTranslations } from '../metadata-admin/previews/flow-label-translations.js';
400-
import type { FlowRegistration } from '@objectstack/spec/api';
407+
import type { DestructiveChangeIssue, FlowRegistration } from '@objectstack/spec/api';
401408
import {
402409
navEntryLabelText,
403410
navItemLabelText,
@@ -5494,6 +5501,14 @@ export function renderStudioGridList(props: {
54945501
);
54955502
}
54965503

5504+
/** One object draft save: the address it writes, the buffer it was taken from, and the body sent. */
5505+
interface ObjDraftSend {
5506+
name: string;
5507+
packageId: string;
5508+
draft: Record<string, unknown>;
5509+
body: Record<string, unknown>;
5510+
}
5511+
54975512
// Exported for tests (StudioDesignSurface.emptyPackage.test.tsx) — the empty-
54985513
// package behavior (no forced creator modal, empty-state CTA) lives here.
54995514
export function DataPillar({
@@ -6187,6 +6202,8 @@ export function DataPillar({
61876202
// keeps its buffer; its save is pinned to the read it was made on.
61886203
if (refreshOnly && objBuffersHeldRef.current) return;
61896204
if (refreshOnly) refreshInstalledRef.current = true;
6205+
objStoredRef.current = authored.body;
6206+
setDestructive(null);
61906207
setObjDraft(authored.body);
61916208
setServedOnly(
61926209
servedOnlyFields((draftBody ?? baseline).fields, [
@@ -6597,46 +6614,92 @@ export function DataPillar({
65976614
[objects, client, railPackageId, onDraftSaved, packageReadOnly, newInPair, customization, locale, namespace],
65986615
);
65996616

6600-
const doSave = React.useCallback(async (sent: DraftSend) => {
6617+
// objectstack#34931 — a save the door refused `409 DESTRUCTIVE_CHANGE`, held
6618+
// for the author's answer: what it would lose, and the save itself. While it
6619+
// is held the autosave sends nothing.
6620+
const [destructive, setDestructive] = React.useState<ObjDraftSend & {
6621+
sent: DraftSend;
6622+
findings: DestructiveChangeIssue[];
6623+
} | null>(null);
6624+
// The object as the server holds it for this buffer (as loaded, or as last
6625+
// saved): what keeping a field restores it from.
6626+
const objStoredRef = React.useRef<Record<string, unknown> | null>(null);
6627+
6628+
const doSave = React.useCallback(async (sent: DraftSend, forced?: ObjDraftSend) => {
66016629
if (!current) return;
66026630
setSaving('draft');
66036631
setError(null);
66046632
// objectui#10202 — the buffer was seeded from the served object, whose
66056633
// picklist-bound fields carry the list's resolved `options`; the door
66066634
// refuses them beside `picklist`, so they stay out of the body.
66076635
// objectui#11785 — kept, so a refusal is read against what was sent.
6608-
const body = dropServedPicklistOptions(objDraft);
6636+
// objectstack#34931 — ⛔ a forced save is the refused save whole: its
6637+
// body, to the address it wrote (`packageId` included), never re-derived.
6638+
const { name, packageId: to, draft, body } =
6639+
forced ?? { name: current.name, packageId, draft: objDraft, body: dropServedPicklistOptions(objDraft) };
66096640
try {
6610-
const outcome = await saveObjDraft('object', current.name, body, { mode: 'draft', packageId, surface: 'studio' });
6641+
const outcome = await saveObjDraft('object', name, body, {
6642+
mode: 'draft',
6643+
packageId: to,
6644+
surface: 'studio',
6645+
...(forced ? { force: true } : {}),
6646+
});
66116647
// objectui#11773 — the author chose the saved version; the load replaces the buffer.
66126648
if (outcome === 'reloaded') return;
6649+
objStoredRef.current = draft;
66136650
setHasDraft(true);
66146651
// objectui#11204 — clean only if nothing was edited while it was in flight.
66156652
if (sent.unmoved()) setDirty(false);
66166653
setSavedAt(new Date());
66176654
// objectstack#27644 — the draft this save stored carries its own publish
66186655
// verdict on its next read; the one held described the body before it.
66196656
const seq = ++objVerdictSeq.current;
6620-
void readDraftForSave(client, 'object', current.name, packageId).then((read) => {
6657+
void readDraftForSave(client, 'object', name, to).then((read) => {
66216658
if (seq !== objVerdictSeq.current) return;
66226659
setObjVerdict(draftEnvelopeDiagnostics(read.answer));
66236660
setObjVerdictBody(extractDraftBody(read.answer) ?? undefined);
66246661
});
66256662
// objectstack#28984 — named by the label this save stored; one toast per
66266663
// object however many editing pauses save it (`announceDraftSaved`).
66276664
announceDraftSaved(
6628-
{ type: 'object', name: current.name },
6665+
{ type: 'object', name },
66296666
typeof body.label === 'string' && body.label ? body.label : current.label,
66306667
locale,
66316668
);
6632-
onDraftSaved?.({ type: 'object', name: current.name });
6669+
onDraftSaved?.({ type: 'object', name });
66336670
} catch (e) {
6634-
setError(objectSaveRefusal(e, body, locale));
6671+
// objectstack#34931 — what the save would lose is asked about, once:
6672+
// a forced save refused again reads as any other refusal.
6673+
const findings = forced ? null : destructiveFindings(e);
6674+
if (findings) setDestructive({ name, packageId: to, draft, body, sent, findings });
6675+
else setError(objectSaveRefusal(e, body, locale));
66356676
} finally {
66366677
setSaving(false);
66376678
}
66386679
}, [saveObjDraft, client, current, objDraft, onDraftSaved, packageId, locale]);
66396680

6681+
// objectstack#34931 — Cancel keeps what the refused save would have lost:
6682+
// each field a finding names goes back as the server holds it, and nothing
6683+
// is sent unless the buffer still differs from what is stored.
6684+
const keepDestructive = React.useCallback(() => {
6685+
const asked = destructive;
6686+
const stored = objStoredRef.current;
6687+
setDestructive(null);
6688+
if (!asked || !stored) return;
6689+
const was = readFields(stored.fields);
6690+
const view = readFields(objDraft.fields);
6691+
for (const { field } of asked.findings) {
6692+
const at = was.entries.findIndex((e) => e.name === field);
6693+
if (at < 0) continue;
6694+
const i = view.entries.findIndex((e) => e.name === field);
6695+
if (i < 0) view.entries.splice(Math.min(at, view.entries.length), 0, was.entries[at]);
6696+
else view.entries[i] = was.entries[at];
6697+
}
6698+
const next = { ...objDraft, fields: writeFields(view) };
6699+
setObjDraft(next);
6700+
setDirty(JSON.stringify(next) !== JSON.stringify(stored));
6701+
}, [destructive, objDraft]);
6702+
66406703
// objectui#11786 — an edit whose body the write guard would refuse (a choice
66416704
// field before its options, a relationship before its target) is held, not
66426705
// sent: it stays dirty and on screen, the field's inspector hints what it
@@ -6654,7 +6717,7 @@ export function DataPillar({
66546717
target: `object:${current?.name ?? ''}`,
66556718
loadedFor: objDraftFor,
66566719
dirty,
6657-
blocked: !current || !!saving || readOnly || saveBlocking > 0 || objIncomplete !== null,
6720+
blocked: !current || !!saving || readOnly || saveBlocking > 0 || objIncomplete !== null || destructive !== null,
66586721
snapshot: objDraft,
66596722
save: doSave,
66606723
});
@@ -7014,12 +7077,15 @@ export function DataPillar({
70147077
try {
70157078
const outcome = await saveObjDraft('object', current.name, wire, { mode: 'draft', packageId, surface: 'studio' });
70167079
if (outcome === 'reloaded') return;
7080+
objStoredRef.current = body;
70177081
setHasDraft(true);
70187082
if (sent.unmoved()) setDirty(false);
70197083
onDraftSaved?.({ type: 'object', name: current.name });
70207084
setGridVer((v) => v + 1); // remount so the grid reflects the new (draft) order
70217085
} catch (e) {
7022-
setError(objectSaveRefusal(e, wire, locale));
7086+
const findings = destructiveFindings(e);
7087+
if (findings) setDestructive({ name: current.name, packageId, draft: body, body: wire, sent, findings });
7088+
else setError(objectSaveRefusal(e, wire, locale));
70237089
} finally {
70247090
setSaving(false);
70257091
}
@@ -7301,6 +7367,38 @@ export function DataPillar({
73017367
return (
73027368
<div ref={pillarRef} className="flex h-full flex-col">
73037369
{objConflictDialog}
7370+
{/* objectstack#34931 — the door's other 409: confirmed, it is sent again forced; else what it would lose is kept. */}
7371+
<AlertDialog open={destructive !== null} onOpenChange={(open) => !open && keepDestructive()}>
7372+
<AlertDialogContent data-testid="object-destructive-confirm">
7373+
<AlertDialogHeader>
7374+
<AlertDialogTitle>{t('engine.edit.destructiveTitle', locale)}</AlertDialogTitle>
7375+
<AlertDialogDescription>{t('engine.edit.destructiveDesc', locale)}</AlertDialogDescription>
7376+
</AlertDialogHeader>
7377+
<ul className="max-h-64 space-y-1 overflow-auto text-sm">
7378+
{destructive?.findings.map((f, i) => (
7379+
<li key={i} className="border-l-2 border-amber-500 pl-2">
7380+
{f.message}
7381+
</li>
7382+
))}
7383+
</ul>
7384+
<AlertDialogFooter>
7385+
<Button variant="ghost" data-testid="object-destructive-keep" onClick={keepDestructive}>
7386+
{t('engine.cancel', locale)}
7387+
</Button>
7388+
<Button
7389+
variant="destructive"
7390+
data-testid="object-destructive-force"
7391+
onClick={() => {
7392+
if (!destructive) return;
7393+
setDestructive(null);
7394+
void doSave(destructive.sent, destructive);
7395+
}}
7396+
>
7397+
{t('engine.edit.forceSave', locale)}
7398+
</Button>
7399+
</AlertDialogFooter>
7400+
</AlertDialogContent>
7401+
</AlertDialog>
73047402
{extConflictDialog}
73057403
{formView.conflictDialog}
73067404
<div className="relative flex min-h-0 flex-1">

0 commit comments

Comments
 (0)