Repository navigation
fix(app-shell): a landed Studio draft autosave names what it saved - #29310
Merged
Merged
Conversation
A draft autosave in the Data, Interfaces and Automations pillars now toasts "Draft saved: LABEL" once the save lands, under one sonner id per item, so repeated saves of one item update one toast instead of stacking. The top bar's saved hint stays; a refused save keeps its refusal and says nothing. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jQxMrtgg1LCjc1NmLf
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jQxMrtgg1LCjc1NmLf
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jQxMrtgg1LCjc1NmLf
Contributor
Author
|
domain:ui#2 · zhuangjianguo · session_01QsR2jRFuJz9QBZqPVHYVhJ 维护者速读
席位意见: 复用 Studio 现有点名提示的口吻和固定 id 写法,五处调用都只在落地之后。实测改前 0 条提示、改后最多 1 条「Draft saved: QA Widget」。无公开面变化, 席位核对 — ACCEPT ·
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Steedos · project thread
Fixes #28984
Clause-②: no
Metadata-protocol: none
The two lines are copied from the claim (comment 6574193432).
维护者速读
ux-conventions.write-feedback的 Studio 自动保存一行一直判红。StudioDesignSurface.tsx里新增的announceDraftSaved及其五处调用(只在保存成功之后调用);新测试DataPillar.draftSavedNamed-28984.test.tsx。pnpm --dir ui exec vitest run packages/app-shell/src/views/studio-design/DataPillar.draftSavedNamed-28984.test.tsx,预期 3 个用例全部通过。What changes
ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx: one module helper,announceDraftSaved, showstoast.success("Draft saved: LABEL", { id })with one sonner id per item (studio-draft-saved:TYPE:NAME). It is called in the five draft autosave saves of this file, right after the save has landed and beforeonDraftSaved:ui/packages/i18n/src/namespaces/studio/en.tsandzh.ts: one new key,engine.studio.draftSaved, "Draft saved: {item}" / 「已保存 {item} 的草稿」, in the voice of the discard row'sengine.edit.draftDiscarded("Draft discarded: {item}")..changeset/28984-studio-draft-saved-named.md,patchfor@object-ui/app-shelland@object-ui/i18n.Why
engine.studio.app.savedDraft,engine.studio.auto.savedDraft). One Studio voice. Sonner's toaster is anaria-liveregion, so the sentence is announced.PACKAGE_LIST_TOAST_IDalready uses in this file). Typing a label gives one live toast; a second item saved meanwhile gets its own.outcome === 'reloaded') saved nothing and announces nothing.StudioRefusalStrip(changed by fix(studio): a refusal in a Studio strip is announced to screen readers #29224, now on main) is not touched; the five call sites and the helper are hunk-disjoint from it.Tests
DataPillar.draftSavedNamed-28984.test.tsx: the Data pillar's real autosave, a realMetadataClientover a fetch double, and sonner's realToastermounted, so the assertions read the toasts on screen.{ id: 'studio-draft-saved:object:showcase_task' }), and the top bar'sdata-saved-athint is there;studio-refusal, no draft-saved toast and no call under that id;scripts/ablation-replace.mjson the committed fix (anchor 1 to 0, blob changed, restore proven equal to HEAD with an emptygit diff HEAD):announceDraftSaved(call replaced by a no-op function call: the landed and the repeated cases went red (expected [] to have a length of 1 but got +0), the refused case stayed green. A first attempt (void (…)) did not parse, so no test ran; it is not counted.one toast, updated in place, not a pile: expected [ …(2) ] to have a length of 1 but got 2), and the landed case at the id.StudioDesignSurface,DataPillar,InterfacesPillarorAutomationsPillar(221), plus the studio namespace tests in@object-ui/i18nand the studio catalogue pins in metadata-admin (zh-base-term.i18n-13131,studioAutomationCopy.plainLanguage-11659,inspectorStrings.studioNamespace-25922): 226 files, 1887 tests, green in five locked batches at c5511bd; after merging main, the same selection (230 files, 1910 tests, the new test included) green again at f9f3982.Acceptance notes
role="alert") landed first as 8a8a03d and is merged in; this PR does not touchStudioRefusalStrip. Seat 5's Studio Interfaces pillar: a leaf edit whose save was refused (422) is seen by no unsaved-changes guard, so a reload drops it silently #29113 and Studio editors still read a refused (403) draft as "no draft" and can save the published body over it: Interfaces app nav, ResourceEditPage, list view inspector, bundle item, permission matrix, hooks #29148 editStudioDesignSurface.tsxafter this one and take it as their serial constraint.engine.studio.data.savedDraft("Object “{label}” saved as draft") is an existing key with no call site. It is not reused here: its "saved as draft" wording is the create rows' voice, and one key for every autosave keeps the five pillars in one voice with discard.Out of scope
Two observations, not measured as defects and not filed. They are listed for the next card on these editors.
useObjectListViewDraft(an Interfaces list-view leaf),ObjectHooksPanel,PermissionMatrixEditorandStudioBundleItemEditorrun the same draft autosave, and the Data pillar's column drag-reorder (doReorderFields) saves a draft directly. None of them callsannounceDraftSaved.ConsoleToaster.autoDismiss-7482). At 1440 px the toast covers the header's Draft chip and saved hint for its 4 s. Publish and discard toasts already show in the same place, so this placement is shared and is not specific to this card.Verification
pnpm build12m31s locked):objectstack dev --seed-admin --freshfor the showcase on a private port, the Console served from source by Vite withDEV_PROXY_TARGET, signed in as the seeded admin. As in the card:POST /api/v1/packages(com.qa.r6wf, namespaceqrsix), thenPUT /api/v1/meta/object/OBJECT?package=com.qa.r6wfwith label "QA Widget",sharingModel: "private"and text fieldsnameandnote. Studio › Data › the object › Form › "Note" › Label cleared and typed "QA Remark" in three bursts with editing pauses, then Tab, sampled every 100 ms to 6 s after the last keystroke.PUT …?mode=draft&package=com.qa.r6wf&surface=studio, all 200. At most one toast on screen at any sample, its text "Draft saved: QA Widget" throughout; the top bar still read "Saved 10:18 AM".StudioDesignSurface.tsx(swapped in under a restartedvite --force, the served module checked to carry noannounceDraftSavedagainst a positive control on the restored file, then restored, blob equal to HEAD andgit diff HEADempty): the same three PUTs, all 200; zero toasts over the window, no status or alert text; only the top bar's "Saved 10:20 AM".ui/packages/i18n/dist/namespaces/studio/en.d.tsdeclaresSTUDIO_ENas aRecordfrom string to string after the build; the new key is inen.jsand in no.d.ts. It widens no published type.node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackderived 34 commands; all 34 ran at c5511bd and again at f9f3982 (after merging main; the same 34 derived), each exit 0, includingnode scripts/check-sdui-manifest.mjsand its--self-test,pnpm check:type-check-debt(locked) andpnpm --dir ui exec vitest run scripts/(locked, 169 files, 4900 tests).--ranreconciliation at f9f3982: 34 derived, 34 run, 0 NOT-MEASURED.turbo run type-check --filter=@object-ui/app-shell --filter=@object-ui/i18n, 66 tasks green at c5511bd and at f9f3982.pnpm install --frozen-lockfileandpnpm build(13m20s locked) were rerun before the re-runs above, and the delta to main is the five files of this PR. The live probe ran at c5511bd; the merge touchedStudioDesignSurface.tsxonly in the refusal strip, which the probe's landed saves never draw.StudioDesignSurface.tsx, none on a changed line. The repo-wide run is CI's Lint UI.Human Minimum
packages/specholds no runtime logic. (Not touched.)pnpm lintpasses. (Measured on the touched files only; see Verification.)main, one pull request.packages/spectouched: its generated artifacts are regenerated and committed. (Not touched.)content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.🤖 Generated with Claude Code
https://claude.ai/code/session_01QsR2jQxMrtgg1LCjc1NmLf
Generated by Claude Code