Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 12 additions & 0 deletions .changeset/21973-nav-view-name-default.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
"@objectstack/spec": patch
---

`ObjectNavItemSchema.viewName`'s describe no longer says the default is "all". It now states what the console does when an object nav entry names no view: it opens the object's default list view, else its first declared list view. `all` is only the console's fallback tab, and it exists only for an object that declares no list view.

Clause-②: no

- The rule is read from objectui at the `.objectui-sha` pin. `ObjectView` opens `defaultViewId || views[0]`, where `defaultViewId` is the view `buildViewTabs` marks `isDefault` (the default `list`). `buildViewTabs` adds the `all` tab only when the object has no list view at all.
- An author who omitted `viewName` expecting all records got that default or first declared view instead. When the object declares more than one list view, name the one the entry should open in `viewName`.
- The generated app reference page follows (#21973). The lint header that quoted the old sentence follows too, as a comment only.
- ⛔ No schema, type, optionality, default, export or accept-set change. The console's behaviour does not change.
10 changes: 5 additions & 5 deletions content/docs/references/ui/app.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ const result = ActionNavItemSchema.parse(data);
| **requiresService** | `string` | optional | Hide/disable this entry unless the named kernel service is registered |
| **type** | `'object'` | ✅ | |
| **objectName** | `string` | ✅ | Target object name |
| **viewName** | `string` | optional | Default list view to open. Defaults to "all". Ignored when `recordId` is set. |
| **viewName** | `string` | optional | Default list view to open. When omitted, the console opens the object's default list view, else its first declared list view; `all` names the console's fallback tab, which exists only for an object that declares no list view. Ignored when `recordId` is set. |
| **recordId** | `string` | optional | Navigate directly to this record id instead of the list view. Supports template vars: `{current_user_id}`, `{current_org_id}`. |
| **recordMode** | `Enum<'view' \| 'edit'>` | optional | Open the record in view (default) or edit mode. Only meaningful when `recordId` is set. |
| **filters** | `Record<string, string>` | optional | URL filter conditions — targets the /:objectName/data bare surface via filter[`<field>`]=`<value>` params instead of a saved view. Values support template vars `{current_user_id}`, `{current_org_id}`. Mutually exclusive with recordId/viewName. |
Expand Down Expand Up @@ -462,7 +462,7 @@ Documentation entry on the app menu (ADR-0046). Targets a `book` and/or a `doc`
| **requiresService** | `string` | optional | Hide/disable this entry unless the named kernel service is registered |
| **type** | `'object'` | ✅ | |
| **objectName** | `string` | ✅ | Target object name |
| **viewName** | `string` | optional | Default list view to open. Defaults to "all". Ignored when `recordId` is set. |
| **viewName** | `string` | optional | Default list view to open. When omitted, the console opens the object's default list view, else its first declared list view; `all` names the console's fallback tab, which exists only for an object that declares no list view. Ignored when `recordId` is set. |
| **recordId** | `string` | optional | Navigate directly to this record id instead of the list view. Supports template vars: `{current_user_id}`, `{current_org_id}`. |
| **recordMode** | `Enum<'view' \| 'edit'>` | optional | Open the record in view (default) or edit mode. Only meaningful when `recordId` is set. |
| **filters** | `Record<string, string>` | optional | URL filter conditions — targets the /:objectName/data bare surface via filter[`<field>`]=`<value>` params instead of a saved view. Values support template vars `{current_user_id}`, `{current_org_id}`. Mutually exclusive with recordId/viewName. |
Expand Down Expand Up @@ -652,7 +652,7 @@ A navigation contribution: a package injecting nav items into an app it does not
| **requiresService** | `string` | optional | Hide/disable this entry unless the named kernel service is registered |
| **type** | `'object'` | ✅ | |
| **objectName** | `string` | ✅ | Target object name |
| **viewName** | `string` | optional | Default list view to open. Defaults to "all". Ignored when `recordId` is set. |
| **viewName** | `string` | optional | Default list view to open. When omitted, the console opens the object's default list view, else its first declared list view; `all` names the console's fallback tab, which exists only for an object that declares no list view. Ignored when `recordId` is set. |
| **recordId** | `string` | optional | Navigate directly to this record id instead of the list view. Supports template vars: `{current_user_id}`, `{current_org_id}`. |
| **recordMode** | `Enum<'view' \| 'edit'>` | optional | Open the record in view (default) or edit mode. Only meaningful when `recordId` is set. |
| **filters** | `Record<string, string>` | optional | URL filter conditions — targets the /:objectName/data bare surface via filter[`<field>`]=`<value>` params instead of a saved view. Values support template vars `{current_user_id}`, `{current_org_id}`. Mutually exclusive with recordId/viewName. |
Expand Down Expand Up @@ -839,7 +839,7 @@ This schema accepts one of the following structures:
| **requiresService** | `string` | optional | Hide/disable this entry unless the named kernel service is registered |
| **type** | `'object'` | ✅ | |
| **objectName** | `string` | ✅ | Target object name |
| **viewName** | `string` | optional | Default list view to open. Defaults to "all". Ignored when `recordId` is set. |
| **viewName** | `string` | optional | Default list view to open. When omitted, the console opens the object's default list view, else its first declared list view; `all` names the console's fallback tab, which exists only for an object that declares no list view. Ignored when `recordId` is set. |
| **recordId** | `string` | optional | Navigate directly to this record id instead of the list view. Supports template vars: `{current_user_id}`, `{current_org_id}`. |
| **recordMode** | `Enum<'view' \| 'edit'>` | optional | Open the record in view (default) or edit mode. Only meaningful when `recordId` is set. |
| **filters** | `Record<string, string>` | optional | URL filter conditions — targets the /:objectName/data bare surface via filter[`<field>`]=`<value>` params instead of a saved view. Values support template vars `{current_user_id}`, `{current_org_id}`. Mutually exclusive with recordId/viewName. |
Expand Down Expand Up @@ -1081,7 +1081,7 @@ Documentation entry on the app menu (ADR-0046). Targets a `book` and/or a `doc`
| **requiresService** | `string` | optional | Hide/disable this entry unless the named kernel service is registered |
| **type** | `'object'` | ✅ | |
| **objectName** | `string` | ✅ | Target object name |
| **viewName** | `string` | optional | Default list view to open. Defaults to "all". Ignored when `recordId` is set. |
| **viewName** | `string` | optional | Default list view to open. When omitted, the console opens the object's default list view, else its first declared list view; `all` names the console's fallback tab, which exists only for an object that declares no list view. Ignored when `recordId` is set. |
| **recordId** | `string` | optional | Navigate directly to this record id instead of the list view. Supports template vars: `{current_user_id}`, `{current_org_id}`. |
| **recordMode** | `Enum<'view' \| 'edit'>` | optional | Open the record in view (default) or edit mode. Only meaningful when `recordId` is set. |
| **filters** | `Record<string, string>` | optional | URL filter conditions — targets the /:objectName/data bare surface via filter[`<field>`]=`<value>` params instead of a saved view. Values support template vars `{current_user_id}`, `{current_org_id}`. Mutually exclusive with recordId/viewName. |
Expand Down
6 changes: 4 additions & 2 deletions packages/lint/src/lint-view-refs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@
*
* A form action target is one way to name a view; an app's navigation is the
* other, and it is the one an end user travels every day. `ObjectNavItemSchema`
* documents `viewName` as *"Default list view to open. Defaults to 'all'"* — so
* an unresolvable name does not fail, it **falls back**. Measured end to end:
* documents `viewName` as *"Default list view to open. When omitted, the console
* opens the object's default list view, else its first declared list view"* —
* and an unresolvable name does not fail, it **falls back** to that same view.
* Measured end to end:
* mutating a real app's `viewName` to a name nothing declares leaves
* `os validate --json` reporting `valid: true`, and `os build` green.
*
Expand Down
12 changes: 11 additions & 1 deletion packages/spec/src/ui/app.zod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,17 @@ export const ObjectNavItemSchema = lazySchema(() => strictObject(navItemSurface(
...BaseNavItemSchema.shape,
type: z.literal('object'),
objectName: z.string().describe('Target object name'),
viewName: z.string().optional().describe('Default list view to open. Defaults to "all". Ignored when `recordId` is set.'),
/**
* The rule this sentence states is the console's, read at the objectui commit
* `.objectui-sha` pins: an entry with no `viewName` links to the bare object
* route, where `ObjectView` opens `defaultViewId || views[0]` — the view
* `buildViewTabs` marks `isDefault` (the default `list`), else the first
* declared list view. Its `all` tab is the fallback `buildViewTabs` adds only
* when the object has no list view at all, so `all` is no default (#21973).
*/
viewName: z.string().optional().describe(
'Default list view to open. When omitted, the console opens the object\'s default list view, else its first declared list view; `all` names the console\'s fallback tab, which exists only for an object that declares no list view. Ignored when `recordId` is set.',
),
/**
* When set, navigate straight to the detail page of this specific
* record instead of the object's list view. Supports template
Expand Down
Loading