Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
d1bcd4c
fix(ui): a view a read-only package ships opens a read-only view pane…
claude Nov 21, 2026
5bf14ea
chore: changeset for the read-only package view panel
claude Nov 21, 2026
ffdc176
test(ui): pay the view panel's dynamic imports at collection
claude Nov 21, 2026
a523cdb
fix(ui): a read-only-package view's Manage views row keeps View confi…
claude Nov 21, 2026
b381718
chore: changeset names the plugin-view widening and the new locale key
claude Nov 21, 2026
8ab622b
fix(i18n): generate the zh-Hant View config label from its zh-Hans so…
claude Nov 21, 2026
c9d195d
Merge origin/main into claude/issue-35974-readonly-package-view-saves
claude Nov 21, 2026
ec9e7de
fix(ui): a read-only package's view hides only Delete in Manage views…
claude Nov 21, 2026
3f5c947
fix(app-shell): a read-only package's view keeps Rename in the option…
claude Nov 21, 2026
c17e284
refactor(plugin-view): drop the unobservable readonly check on defini…
claude Nov 21, 2026
2e34976
chore(changeset): describe ruling B for objectstack#35974 and list th…
claude Nov 21, 2026
eb72cf0
Merge origin/main into claude/issue-35974-readonly-package-view-saves
claude Nov 21, 2026
60a4b3b
fix(app-shell): the view panel's read-only verdict is the one that dr…
claude Nov 21, 2026
ec456e0
Merge origin/main into claude/issue-35974-readonly-package-view-saves
claude Nov 21, 2026
5f754fb
Merge origin/main into claude/issue-35974-readonly-package-view-saves
claude Nov 21, 2026
224cb17
chore(changeset): note the late read-only verdict on objectstack#3597…
claude Nov 21, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .changeset/35974-read-only-package-view-panel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
'@object-ui/app-shell': patch
'@object-ui/console': patch
'@object-ui/plugin-view': patch
'@object-ui/i18n': patch
---

fix(ui): a view a read-only package ships hides only Delete in Manage views and opens its view panel read-only

Clause-②: yes (widening)
Metadata-protocol: none

This applies to a list view that ships inside a read-only package (a code or installed package). The console no longer offers that view the two writes the server refuses:

- Manage views hides Delete on its row.
- The row's configuration entry reads "View config". It opens the admin's view panel read-only: the configuration is shown read-only, no edit reaches the list, and there is nothing to save. The panel has no Save, no draft bar to publish or discard, and only Close.

Rename, pin and set as default stay offered. They land in that package's customization (the console creates it on first use), so no lock icon is drawn on the row. The list's options menu offers Rename on such a view again. A shared view the console saved into the customization package, and the reader's own view, are unchanged. The toolbar's personal list changes keep saving to the reader's preferences.

`@object-ui/plugin-view`: `ViewTabItem` gains an optional `definitionReadonly` field. When it is `true`, `ManageViewsDialog` hides Delete and labels the configuration entry "View config" (`view.showViewConfig`, a new key in every locale of `@object-ui/i18n`). Rename, pin, set as default and the configuration entry stay. `readonly` still wins when both are set. Without the field a row behaves as before. `ViewTabBar` does not read it.

The read-only verdict is the one the footer calculation menu already uses. The console takes the package the view row was served under and reads the server's `writable` verdict for it from the package list it holds for the session. While that list is unread, or when the read fails or does not name the package, everything stays offered as before and the server's refusal still applies. The view panel reads the same answer that drew the Manage views row, so a row's "View config" never opens an editable panel. If the answer arrives after the admin has started editing, the panel turns read-only and discards the edit: the list's preview goes back to the stored view.
56 changes: 55 additions & 1 deletion ui/packages/app-shell/src/hooks/useStudioDesignGate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
* @module
*/

import { useEffect, useState } from 'react';
import { useEffect, useMemo, useState } from 'react';
import { useAuth, useWorkspaceAdminStatus } from '@object-ui/auth';
import { useCanAuthorMetadata } from './useCanAuthorMetadata.js';
import { fetchSessionPackages, type PkgEntry } from '../views/studio-design/packages-io.js';
Expand Down Expand Up @@ -207,3 +207,57 @@ export function useStudioDesignGate(path: string | null | undefined): string | n
export function usePackageRefusesSaves(packageId: string | null): boolean {
return usePackagePosture(packageId) === 'view';
}

const NO_REFUSING_PACKAGES: ReadonlySet<string> = new Set();

/**
* objectstack#35974 — {@link usePackageRefusesSaves} for a list of packages
* at once, for a surface that draws one row per view (Manage views): the ids
* among `packageIds` the package list carries as read-only. The same
* `writable` verdict, the same session-held read (`fetchSessionPackages`: at
* most one `GET /api/v1/packages` per new package id per session, concurrent
* asks sharing it) and the same fail-open: an id still being read, an
* id whose read failed and an id the list leaves out are not in the answer, so
* that row keeps what it offered before this read.
*
* Keyed on the ids themselves, never on the array's identity: callers may hand
* a fresh array each render. Each id's answer is kept for the session as it
* lands, so a change to the list of ids (a refetch that brings a view of a new
* package) never takes back what is already known: a surface reading this
* while open, such as the view panel, cannot flip back to savable.
*/
export function usePackagesRefusingSaves(packageIds: readonly string[]): ReadonlySet<string> {
const session = usePackageListSession();
const key = JSON.stringify([...new Set(packageIds)].sort());
const [answers, setAnswers] = useState<{
session: string;
refuses: ReadonlyMap<string, boolean>;
} | null>(null);
useEffect(() => {
const ids = JSON.parse(key) as string[];
let cancelled = false;
for (const id of ids) {
fetchSessionPackages(session, id).then((list) => {
if (cancelled) return;
const refuses = packageStudioPosture(list, id) === 'view';
setAnswers((prev) => {
const known = prev && prev.session === session ? prev.refuses : new Map<string, boolean>();
if (known.get(id) === refuses) return prev;
const next = new Map(known);
next.set(id, refuses);
return { session, refuses: next };
});
}, () => {
// A failed read answers nothing: the id keeps what it offered.
});
}
return () => {
cancelled = true;
};
}, [key, session]);
return useMemo(() => {
if (!answers || answers.session !== session) return NO_REFUSING_PACKAGES;
const refusing = (JSON.parse(key) as string[]).filter((id) => answers.refuses.get(id) === true);
return refusing.length === 0 ? NO_REFUSING_PACKAGES : new Set(refusing);
}, [answers, key, session]);
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

/**
* objectstack#35933 — a view a read-only package ships offers an admin no save
* of its own: no footer calculation menu (objectstack#35702) and no Rename in
* the list's options menu. A shared view the console saved into the
* of its own: no footer calculation menu (objectstack#35702). Its Rename in
* the list's options menu stays (objectstack#35974): the label is written into
* the package's customization pair. A shared view the console saved into the
* customization package, and the reader's own view, still offer the menu.
*
* A dotted view name cannot tell the two apart: every stored view is named
Expand Down Expand Up @@ -176,12 +177,14 @@ afterEach(() => {
});

describe('objectstack#35933 — a read-only package\'s view offers no save of its own', () => {
it('a view a read-only package ships: no calculation menu, no Rename', async () => {
it('a view a read-only package ships: no calculation menu; Rename stays (objectstack#35974)', async () => {
mount(SHIPPED.name);
await settle();
await waitFor(() => expect(listProps.current).not.toBeNull());
expect(offersMenu()).toBe(false);
expect(listProps.current?.onRenameView).toBeUndefined();
// objectstack#35974 — the rename lands in the package's customization
// pair (`updateView`), so it is offered.
expect(typeof listProps.current?.onRenameView).toBe('function');
});

it('a shared view saved into the customization package keeps the menu and Rename', async () => {
Expand Down
Loading
Loading