Skip to content

Commit 9934edb

Browse files
os-zhuangclaude
andauthored
refactor(plugin-view): suppress duplicate renderNamedViewTabs in app-shell (ADR-0053) (#1803)
Add hideNamedViewTabs prop to the plugin-view ObjectView; app-shell ObjectView sets it (both PluginObjectView mount points) because it already renders the canonical ViewTabBar. Standalone consumers (byo-backend-console, SystemObjectViewPage) leave it unset and keep their only switcher. Removes the latent duplicate named-view tab row in app-shell context. Verified: object list shows one switcher row, 10 records render, no errors. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent b1062a0 commit 9934edb

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

packages/app-shell/src/views/ObjectView.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1703,6 +1703,7 @@ function ObjectViewInner({ dataSource, objects, onEdit, externalRefreshKey }: an
17031703
}}
17041704
renderListView={renderListView}
17051705
onCreateView={handleCreateView}
1706+
hideNamedViewTabs
17061707
onViewAction={handleViewAction}
17071708
/>
17081709
</div>
@@ -1745,6 +1746,7 @@ function ObjectViewInner({ dataSource, objects, onEdit, externalRefreshKey }: an
17451746
}}
17461747
renderListView={renderListView}
17471748
onCreateView={handleCreateView}
1749+
hideNamedViewTabs
17481750
onViewAction={handleViewAction}
17491751
/>
17501752
</div>

packages/plugin-view/src/ObjectView.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,13 @@ export interface ObjectViewProps {
122122
* Render a custom ListView implementation for multi-view support.
123123
* When provided, this replaces the default view rendering for the content area.
124124
*/
125+
/**
126+
* ADR-0053: when the host (app-shell ObjectView) already renders the view
127+
* switcher (ViewTabBar), set this so the inner view doesn't render its own
128+
* duplicate named-view tab row. Standalone consumers leave it unset.
129+
*/
130+
hideNamedViewTabs?: boolean;
131+
125132
renderListView?: (props: {
126133
schema: any;
127134
dataSource: DataSource;
@@ -209,6 +216,7 @@ export const ObjectView: React.FC<ObjectViewProps> = ({
209216
onRowClick,
210217
onEdit: onEditProp,
211218
renderListView,
219+
hideNamedViewTabs,
212220
toolbarAddon,
213221
onCreateView,
214222
onViewAction,
@@ -1034,6 +1042,8 @@ export const ObjectView: React.FC<ObjectViewProps> = ({
10341042

10351043
// --- Named list views tabs ---
10361044
const renderNamedViewTabs = () => {
1045+
// ADR-0053: host owns the switcher (ViewTabBar) — don't duplicate it.
1046+
if (hideNamedViewTabs) return null;
10371047
if (!hasNamedViews) return null;
10381048
const entries = Object.entries(namedListViews!);
10391049
if (entries.length <= 1) return null;

0 commit comments

Comments
 (0)