Skip to content

Commit 4cd0a0d

Browse files
xuyushun441-sysos-zhuangclaude
authored
feat(studio): scope editor post-save refresh by package (ADR-0048 #1824) (#1715)
The metadata editor's post-save refresh re-read its layered + draft state context-free. With package-scoped overlays (framework #1827), two packages may ship the same type/name; the refresh now passes the same ?package= the initial load + save use, so the editor re-reads this package's own row after saving. Co-authored-by: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent aaddb85 commit 4cd0a0d

2 files changed

Lines changed: 15 additions & 3 deletions

File tree

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
"@object-ui/app-shell": patch
3+
---
4+
5+
ADR-0048 (#1824): the Studio metadata editor's post-save refresh now scopes its
6+
layered + draft re-read to the same package as the initial load (`?package=`), so
7+
when two installed packages ship the same `type`/`name` the editor re-reads
8+
this package's own row after saving — not another package's. The save itself
9+
already binds the package; this aligns the refresh with it.

packages/app-shell/src/views/metadata-admin/ResourceEditPage.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -892,10 +892,13 @@ function MetadataResourceEditPageImpl({
892892
mode: 'draft',
893893
...(activePackage ? { packageId: activePackage } : {}),
894894
});
895-
// Refresh layered + draft state after save.
895+
// Refresh layered + draft state after save — scope to the same package
896+
// as the initial load (ADR-0048) so a same-name collision re-reads this
897+
// package's own row, not another's.
898+
const refreshScope = ownerPackageId ? { packageId: ownerPackageId } : {};
896899
const [lay, draftResp] = await Promise.all([
897-
client.layered<any>(type, savedName),
898-
client.getDraft<any>(type, savedName).catch(() => null),
900+
client.layered<any>(type, savedName, refreshScope),
901+
client.getDraft<any>(type, savedName, refreshScope).catch(() => null),
899902
]);
900903
setLayered(lay);
901904
const draftReal = extractDraftBody(draftResp);

0 commit comments

Comments
 (0)