Skip to content

Commit 8c5a81e

Browse files
fix(plugin-list): Refresh alone no longer draws the Display entry in the default list toolbar (#36339)
<!-- claude-projects-attribution: {"github_login":"os-project-manager"} --> _Requested by **Leehom** · [project thread](https://claude.ai/code/project/chan_01TenzsRopZj4jMbvjX8uz1X?thread=cmsg_01TenzsRopZj4jMbvjX8uz1XURgXCZHcjPoyo5g9cMEATi)_ Fixes #36002 Clause-②: no Metadata-protocol: none ## 维护者速读 - 列表默认工具栏里,看板、日历这类视图如果除了刷新外没有别的显示选项,就不再出现一个点开只有底栏的空「显示」入口;宽工具栏的刷新按钮照旧。 - 属于「列表页重做」专题:两行工具栏按「刷新去掉」落地后剩下的收尾。 - 出错时最坏是这类视图少了「显示」入口,而它本来就没有可用的选项;改动小,可整体撤回。 - 无。 ## What changes - `ui/packages/plugin-list/src/ListView.tsx`: `displayOffered` no longer ORs `toolbarFlags.showRefresh`. The default (Display) toolbar has no Refresh since the two-row toolbar landed, neither on the bar nor in the panel (`viewSettingsElement` is handed no refresh prop), so the key was the only reason a non-grid view with every other Display control off drew a Display entry that opened onto just the footer. The stale Refresh comment ("in the Display form it sits in the panel's footer") now says Refresh is wide-form only. - `packages/spec/src/ui/view.zod.ts`: the `userActions.refresh` describe says the toggle governs only the wide toolbar's Refresh (`compactToolbar: false`) and changes nothing in the default toolbar. Description text only: key, type and default unchanged; no retirement (card item 2, first branch, per the claim). - `packages/spec/src/ui/view.form.ts`: the form hint for `userActions.refresh` mirrors the new describe. Required, not chosen: `src/ui/view-form-composite-children.test.ts` pins every `userActions` hint equal to the schema description it replaces, and went red without it. - Regenerated, never hand-edited: `content/docs/references/ui/{view,page}.mdx` (`check:generated --fix`, which named only `check:docs` stale) and `packages/platform-objects/src/apps/translations/en.metadata-forms.generated.ts` (`node scripts/check-i18n-bundles.mjs --write --filter=platform-objects`; the other ten locales keep their hand-written translations, no source-hash entries exist for this leaf). - Pin: a new top-level block `ListView.refreshOnlyDisplay-36002` in the shared `ListView.harness.test.tsx` (the harness rule: a ListView pin that needs no `vi.mock` joins that file). A kanban view with Group, Row height and Hide fields off and `refresh` at its default draws no `toolbar-display-trigger`; CONTROLS: `compactToolbar: false` still draws `refresh-button`, and the same view with Row height on draws the Display entry. - Changeset `.changeset/36002-refresh-display-panel.md`: patch for `@object-ui/plugin-list`, `@objectstack/spec`, `@objectstack/platform-objects`. Read first, by risk: 1. `ui/packages/plugin-list/src/ListView.tsx`, the `displayOffered` hunk: the one behaviour change. 2. `packages/spec/src/ui/view.zod.ts`, the `refresh` describe: a published-schema text face (contract review on record before landing). 3. `ui/packages/plugin-list/src/__tests__/ListView.harness.test.tsx`, the new block at the end. ## Tests Final head: `75244b315e1d79c1455fbd2d343e00be5fbcbf8b` (declared by the resuming thread; no commit added after the handover). - CI at `75244b31`: all 70 check-runs completed, each `success` or `skipped` (Test Core 10/10 shards, Test UI 16/16 shards, Type Check UI, Lint UI, Build & E2E UI, Live E2E UI, Lint & Repo Gates, TypeScript Type Check, Check Changeset, Spec property liveness, Governed Surface Queue Guard, PR-body guards). <details><summary>Local readings (all under scripts/pm/os-verify-lock.sh)</summary> - Final-head union at `75244b31`, after building the `@objectstack/platform-objects...` and `@object-ui/plugin-list^...` closures (VERDICT command-exit 0): `pnpm --filter @objectstack/spec test` Test Files 869 passed (869), Tests 27877 passed, 1 todo (27878); `pnpm --filter @objectstack/platform-objects test` Test Files 125 passed (125), Tests 2126 passed (2126); harness file `ListView.harness.test.tsx` Test Files 1 passed (1), Tests 127 passed (127). Each VERDICT command-exit 0. - Harness file `ListView.harness.test.tsx`: Test Files 1 passed (1), Tests 127 passed (127) at fa1bd43 (the fix commit). - `pnpm --filter @object-ui/plugin-list test`: Test Files 183 passed (183), Tests 1998 passed (1998) at d6ea716 (later commits touch no `ui/` file). - `pnpm --filter @object-ui/plugin-list type-check`: exit 0 at d6ea716. - `pnpm --filter @objectstack/spec typecheck`: exit 0 at d6ea716. - `pnpm --filter @objectstack/spec test` at d6ea716: 1 failed (`view-form-composite-children.test.ts`, the hint pin), fixed by e680c59; that file then 20 passed (20). - `pnpm --dir ui exec vitest run scripts/`: 172 passed, 2 skipped (174 files) at d6ea716. </details> <details><summary>Ablation (one-shot, not kept)</summary> Committed fix first, then `node scripts/ablation-replace.mjs` put `|| toolbarFlags.showRefresh` back into `displayOffered` (anchor x1 -> x0, blob d73fea0 -> bdd2b94ef1ae). With `-t refreshOnlyDisplay-36002`: the pin went red (`the default toolbar draws no Display entry when Refresh was its only option` failed), both CONTROLS stayed green; 1 failed / 2 passed. Restore: blob == HEAD (d73fea0), `git diff HEAD` empty; re-run 3 passed. The test imports `../ListView` (source), so no dist rebuild was in the path. </details> ## Acceptance notes - Card acceptance 1 ("A view whose only display option was Refresh no longer opens an empty Display panel in the default toolbar"): pinned by the new block, ablation red without the fix. Only non-grid views can reach it: the grid always offers Display (`currentView === 'grid'`, its columns). - Card acceptance 2 ("The key's describe matches what it does"): describe, form hint and generated references now say wide-toolbar only. - Skills/docs measured for text claiming `userActions.refresh` governs the default toolbar: zero hits in `skills/**`, `content/docs/**` (outside `references/` and `releases/`) and `ui/**/*.md`; control term `userActions.editInline` hits `content/docs/frontend/plugins/plugin-view.mdx`. No stale text to name. - Noted, not filed: the ten translated locales of the `userActions.refresh` form hint still carry only the first sentence (still true, now less precise than English). Translation is a translator's edit, outside this card. - Noted, not filed: the spec describe of `compactToolbar` ("Collapse Group/Color/Density/Hide-fields into a single View settings popover") does not say that collapsing is the renderer default (`schema.compactToolbar !== false`) nor that Refresh is dropped; observation only. - File surface beyond the first claim: `packages/spec/src/ui/view.form.ts` and the regenerated `en.metadata-forms.generated.ts`, both forced by the hint pin above; the seat amends the claim. - Overlap: `node scripts/pm/overlap-check.mjs` re-run at `75244b31`: VERDICT clean against `origin/main` b3bcfef and #36343 (shares `ListView.tsx`), merges cleanly. Earlier run: clean against #36223 (since merged). ## Verification Two-minute check: `cd ui && pnpm exec vitest run packages/plugin-list/src/__tests__/ListView.harness.test.tsx -t refreshOnlyDisplay-36002` shows 3 passed. In the Console, a kanban list view with `userActions: { group: false, rowHeight: false, hideFields: false }` shows no Display button beside the view name; set `compactToolbar: false` and the Refresh button appears on the bar. <details><summary>Gates</summary> - `node scripts/pm/dispatch-gates.mjs --commands` on the final diff: 119 commands; all run locally; `--ran` reconciliation "119 derived famil(ies) accounted for — 119 run, 0 NOT-MEASURED". - Exit 0: 115. Exit 3 (PREREQUISITE NOT MET, NOT MEASURED locally, CI measures): `node scripts/check-plugin-teardown-shape.mjs --self-test` (shallow clone cannot reach its pinned fixture commit), `pnpm check:dual-build-cjs-loads` (whole-tree dist absent), `pnpm check:type-check-debt` (re-measure needs the whole build), `pnpm --filter @objectstack/spec run check:skill-examples` (client-react dist absent). - `pnpm --filter @objectstack/spec check:generated`: all 14 generated artifacts up to date; `node scripts/check-i18n-bundles.mjs`: OK, all bundles in sync. - `node scripts/pm/dispatch-gates.mjs --tier` re-derived at `75244b31` by the resuming thread: no path-derived mandate (default tier). </details> 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- signed: repo:objectstack#7 · zhuangjianguo · session_01QsR2jRPEaXTds3tgVP5XEY --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 3faabd2 commit 8c5a81e

8 files changed

Lines changed: 104 additions & 12 deletions

File tree

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
'@object-ui/plugin-list': patch
3+
'@objectstack/spec': patch
4+
'@objectstack/platform-objects': patch
5+
---
6+
7+
fix(plugin-list): Refresh alone no longer draws the Display entry in the default list toolbar
8+
9+
Clause-②: no
10+
Metadata-protocol: none
11+
12+
The default (Display) list toolbar has no Refresh button, yet `userActions.refresh` still counted as a reason to draw the toolbar's Display entry. On a non-grid view (kanban, calendar and the rest) whose other Display controls were all off, the entry opened a panel holding only its footer. Refresh no longer counts, so such a view draws no Display entry. The wide toolbar (`compactToolbar: false`) still draws Refresh as before, and `userActions.refresh: false` still takes it off there.
13+
14+
`@objectstack/spec`: the `userActions.refresh` description now says the toggle governs only the wide toolbar's Refresh button and changes nothing in the default toolbar. The view form's hint for the key says the same, and `@objectstack/platform-objects` ships it as the English help text in the metadata-forms bundle; the other locales keep their existing translations. Only the description text changed: the key, its type and its default are the same.

‎content/docs/references/ui/page.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ An any-of group: `{ or: [rule, ...] }` matches a record when ANY of its rules ma
180180
| **sort** | `boolean` | optional (default: `true`) | Allow users to sort records |
181181
| **search** | `boolean` | optional (default: `true`) | Allow users to search records |
182182
| **filter** | `boolean` | optional (default: `true`) | Allow users to filter records |
183-
| **refresh** | `boolean` | optional (default: `true`) | Allow users to reload the view data from the backend without a full page reload |
183+
| **refresh** | `boolean` | optional (default: `true`) | Allow users to reload the view data from the backend without a full page reload. Governs only the wide toolbar's Refresh button (`compactToolbar: false`): the default toolbar has no Refresh, so the toggle changes nothing there. |
184184
| **rowHeight** | `boolean` | optional (default: `true`) | Allow users to toggle row height/density |
185185
| **group** | `boolean` | optional (default: `true`) | Allow users to change record grouping from the toolbar. Toggle only — the grouping itself is configured in the view-level `grouping` block. |
186186
| **addRecordForm** | `boolean` | optional (default: `false`) | Add records through a form instead of inline |

‎content/docs/references/ui/view.mdx‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,7 +1096,7 @@ An any-of group: `{ or: [rule, ...] }` matches a record when ANY of its rules ma
10961096
| **sort** | `boolean` | optional (default: `true`) | Allow users to sort records |
10971097
| **search** | `boolean` | optional (default: `true`) | Allow users to search records |
10981098
| **filter** | `boolean` | optional (default: `true`) | Allow users to filter records |
1099-
| **refresh** | `boolean` | optional (default: `true`) | Allow users to reload the view data from the backend without a full page reload |
1099+
| **refresh** | `boolean` | optional (default: `true`) | Allow users to reload the view data from the backend without a full page reload. Governs only the wide toolbar's Refresh button (`compactToolbar: false`): the default toolbar has no Refresh, so the toggle changes nothing there. |
11001100
| **rowHeight** | `boolean` | optional (default: `true`) | Allow users to toggle row height/density |
11011101
| **group** | `boolean` | optional (default: `true`) | Allow users to change record grouping from the toolbar. Toggle only — the grouping itself is configured in the view-level `grouping` block. |
11021102
| **addRecordForm** | `boolean` | optional (default: `false`) | Add records through a form instead of inline |
@@ -1484,7 +1484,7 @@ An any-of group: `{ or: [rule, ...] }` matches a record when ANY of its rules ma
14841484
| **sort** | `boolean` | optional (default: `true`) | Allow users to sort records |
14851485
| **search** | `boolean` | optional (default: `true`) | Allow users to search records |
14861486
| **filter** | `boolean` | optional (default: `true`) | Allow users to filter records |
1487-
| **refresh** | `boolean` | optional (default: `true`) | Allow users to reload the view data from the backend without a full page reload |
1487+
| **refresh** | `boolean` | optional (default: `true`) | Allow users to reload the view data from the backend without a full page reload. Governs only the wide toolbar's Refresh button (`compactToolbar: false`): the default toolbar has no Refresh, so the toggle changes nothing there. |
14881488
| **rowHeight** | `boolean` | optional (default: `true`) | Allow users to toggle row height/density |
14891489
| **group** | `boolean` | optional (default: `true`) | Allow users to change record grouping from the toolbar. Toggle only — the grouping itself is configured in the view-level `grouping` block. |
14901490
| **addRecordForm** | `boolean` | optional (default: `false`) | Add records through a form instead of inline |
@@ -1669,7 +1669,7 @@ User action toggles for the view toolbar
16691669
| **sort** | `boolean` | optional (default: `true`) | Allow users to sort records |
16701670
| **search** | `boolean` | optional (default: `true`) | Allow users to search records |
16711671
| **filter** | `boolean` | optional (default: `true`) | Allow users to filter records |
1672-
| **refresh** | `boolean` | optional (default: `true`) | Allow users to reload the view data from the backend without a full page reload |
1672+
| **refresh** | `boolean` | optional (default: `true`) | Allow users to reload the view data from the backend without a full page reload. Governs only the wide toolbar's Refresh button (`compactToolbar: false`): the default toolbar has no Refresh, so the toggle changes nothing there. |
16731673
| **rowHeight** | `boolean` | optional (default: `true`) | Allow users to toggle row height/density |
16741674
| **group** | `boolean` | optional (default: `true`) | Allow users to change record grouping from the toolbar. Toggle only — the grouping itself is configured in the view-level `grouping` block. |
16751675
| **addRecordForm** | `boolean` | optional (default: `false`) | Add records through a form instead of inline |

‎packages/platform-objects/src/apps/translations/en.metadata-forms.generated.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1307,7 +1307,7 @@ export const enMetadataForms: NonNullable<TranslationData['metadataForms']> = {
13071307
},
13081308
"userActions.refresh": {
13091309
label: "Refresh",
1310-
helpText: "Allow users to reload the view data from the backend without a full page reload"
1310+
helpText: "Allow users to reload the view data from the backend without a full page reload. Governs only the wide toolbar's Refresh button (`compactToolbar: false`): the default toolbar has no Refresh, so the toggle changes nothing there."
13111311
},
13121312
"userActions.rowHeight": {
13131313
label: "Row Height",

‎packages/spec/src/ui/view.form.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ export const viewForm = defineForm({
247247
{ field: 'sort', helpText: 'Allow users to sort records' },
248248
{ field: 'search', helpText: 'Allow users to search records' },
249249
{ field: 'filter', helpText: 'Allow users to filter records' },
250-
{ field: 'refresh', helpText: 'Allow users to reload the view data from the backend without a full page reload' },
250+
{ field: 'refresh', helpText: 'Allow users to reload the view data from the backend without a full page reload. Governs only the wide toolbar\'s Refresh button (`compactToolbar: false`): the default toolbar has no Refresh, so the toggle changes nothing there.' },
251251
{ field: 'rowHeight', helpText: 'Allow users to toggle row height/density' },
252252
{ field: 'group', helpText: 'Allow users to change record grouping from the toolbar. Toggle only — the grouping itself is configured in the view-level `grouping` block.' },
253253
{ field: 'addRecordForm', helpText: 'Add records through a form instead of inline' },

‎packages/spec/src/ui/view.zod.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1968,7 +1968,7 @@ export const UserActionsConfigSchema = lazySchema(() => strictObject({
19681968
sort: z.boolean().default(true).describe('Allow users to sort records'),
19691969
search: z.boolean().default(true).describe('Allow users to search records'),
19701970
filter: z.boolean().default(true).describe('Allow users to filter records'),
1971-
refresh: z.boolean().default(true).describe('Allow users to reload the view data from the backend without a full page reload'),
1971+
refresh: z.boolean().default(true).describe('Allow users to reload the view data from the backend without a full page reload. Governs only the wide toolbar\'s Refresh button (`compactToolbar: false`): the default toolbar has no Refresh, so the toggle changes nothing there.'),
19721972
rowHeight: z.boolean().default(true).describe('Allow users to toggle row height/density'),
19731973
group: z.boolean().default(true).describe('Allow users to change record grouping from the toolbar. Toggle only — the grouping itself is configured in the view-level `grouping` block.'),
19741974
addRecordForm: z.boolean().default(false).describe('Add records through a form instead of inline'),

‎ui/packages/plugin-list/src/ListView.tsx‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7062,10 +7062,12 @@ export const ListView = React.forwardRef<ListViewHandle, ListViewProps>(({
70627062
}, [shownRowsKey, shownRowsSettled]);
70637063

70647064
// The Display panel (objectui#12423) is the default form of the toolbar's
7065-
// settings cluster, drawn whenever it has a control to offer.
7065+
// settings cluster, drawn whenever it has a control to offer. Refresh is not
7066+
// one of them: the default toolbar has no Refresh (objectstack#35878), so
7067+
// `userActions.refresh` alone never draws the panel (objectstack#36002).
70667068
const displayOffered = toolbarFlags.compactToolbar && !!(
70677069
viewSwitcherOffered || toolbarFlags.showGroup || toolbarFlags.showColor || toolbarFlags.showDensity
7068-
|| toolbarFlags.showHideFields || currentView === 'grid' || toolbarFlags.showRefresh
7070+
|| toolbarFlags.showHideFields || currentView === 'grid'
70697071
|| (resolvedExportOptions && exportPermitted && exportableFormats.length > 0)
70707072
);
70717073
// The condition controls (objectstack#35549, objectstack#35550): the Filter
@@ -7854,9 +7856,9 @@ export const ListView = React.forwardRef<ListViewHandle, ListViewProps>(({
78547856

78557857
{/* Refresh — re-fetch the current view from the backend without a full page
78567858
reload. Filters / sort / pagination / search all live in component state,
7857-
so bumping refreshKey re-queries while preserving the view. In the wide
7858-
form a bar button (mobile + desktop); in the Display form it sits in
7859-
the panel's footer. */}
7859+
so bumping refreshKey re-queries while preserving the view. Wide form
7860+
only, a bar button (mobile + desktop): the default (Display) toolbar
7861+
has no Refresh, neither on the bar nor in the panel (objectstack#35878). */}
78607862
{toolbarFlags.showRefresh && !toolbarFlags.compactToolbar && (
78617863
<Button
78627864
variant="ghost"

‎ui/packages/plugin-list/src/__tests__/ListView.harness.test.tsx‎

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3591,3 +3591,79 @@ describe('ListView.groupPickerUnstored-32631', () => {
35913591
});
35923592
});
35933593
});
3594+
3595+
// ── ListView.refreshOnlyDisplay-36002 ───────────────────────────────────────────
3596+
3597+
/**
3598+
* objectstack#36002 — the default (Display) toolbar has no Refresh
3599+
* (objectstack#35878, 「刷新去掉」), so `userActions.refresh` is not a reason to
3600+
* draw the Display entry. A non-grid view whose every other Display control is
3601+
* off (no layout switch, Group, Row height, Hide fields, Row colour or Export)
3602+
* draws no Display entry at all, instead of one that opens a panel with only
3603+
* its footer. The grid always offers Display (its columns), so the fixture is
3604+
* a kanban. The CONTROLS: the key still draws the wide toolbar's Refresh, and
3605+
* the same fixture with one Display control on draws the entry again.
3606+
*/
3607+
describe('ListView.refreshOnlyDisplay-36002', () => {
3608+
restoreAfterBlock();
3609+
3610+
/** Every Display control off; `refresh` is left at its default, on. */
3611+
const REFRESH_ONLY: ListViewSchema = {
3612+
type: 'list-view',
3613+
objectName: 'opportunity',
3614+
viewType: 'kanban',
3615+
fields: ['name', 'stage'],
3616+
kanban: { groupByField: 'stage' },
3617+
userActions: { group: false, rowHeight: false, hideFields: false },
3618+
} as ListViewSchema;
3619+
3620+
let previousKanban: ReturnType<typeof ComponentRegistry.get>;
3621+
3622+
beforeEach(() => {
3623+
previousKanban = ComponentRegistry.get('object-kanban');
3624+
ComponentRegistry.register('object-kanban', () => <div data-testid="kanban-stub" />);
3625+
});
3626+
3627+
afterEach(() => {
3628+
cleanup();
3629+
if (previousKanban) ComponentRegistry.register('object-kanban', previousKanban as any);
3630+
});
3631+
3632+
function mount(schema: Partial<ListViewSchema> = {}) {
3633+
const dataSource = {
3634+
find: vi.fn().mockResolvedValue({ data: [{ id: '1', name: 'Acme', stage: 'won' }], total: 1 }),
3635+
findOne: vi.fn(),
3636+
create: vi.fn(),
3637+
update: vi.fn(),
3638+
delete: vi.fn(),
3639+
getObjectSchema: vi.fn().mockResolvedValue({
3640+
name: 'opportunity',
3641+
fields: { name: { type: 'text', label: 'Name' }, stage: { type: 'text', label: 'Stage' } },
3642+
}),
3643+
};
3644+
render(
3645+
<SchemaRendererProvider dataSource={dataSource as never}>
3646+
<ListView schema={{ ...REFRESH_ONLY, ...schema } as ListViewSchema} dataSource={dataSource as never} />
3647+
</SchemaRendererProvider>,
3648+
);
3649+
}
3650+
3651+
it('the default toolbar draws no Display entry when Refresh was its only option', async () => {
3652+
mount();
3653+
await screen.findByTestId('kanban-stub');
3654+
expect(screen.queryByTestId('toolbar-display-trigger')).toBeNull();
3655+
expect(screen.queryByTestId('refresh-button')).toBeNull();
3656+
});
3657+
3658+
it('CONTROL — the wide toolbar (`compactToolbar: false`) still draws Refresh for the same view', async () => {
3659+
mount({ compactToolbar: false } as Partial<ListViewSchema>);
3660+
await screen.findByTestId('kanban-stub');
3661+
expect(screen.getByTestId('refresh-button')).toBeInTheDocument();
3662+
});
3663+
3664+
it('CONTROL — the same view with Row height on draws the Display entry', async () => {
3665+
mount({ userActions: { group: false, rowHeight: true, hideFields: false } } as Partial<ListViewSchema>);
3666+
await screen.findByTestId('kanban-stub');
3667+
expect(screen.getByTestId('toolbar-display-trigger')).toBeInTheDocument();
3668+
});
3669+
});

0 commit comments

Comments
 (0)