Skip to content

Commit ed4a000

Browse files
committed
refactor(app-shell): move ObjectView's view management handlers into a sibling hook (slice 11b)
The view-config save and create handlers, the draft field update, view switching, the mobile view switcher registration and the view-tab CRUD callbacks move verbatim from ObjectViewInner into useObjectViewViewCrud (objectViewViewCrud.tsx). The panel and dialog state stays in the component. Six source-scan readers follow the moved handlers (path or file-list edits only). Claude-Session: https://claude.ai/code/session_01QciHBvFJXnhZqXmdqpDtpz Co-authored-by: Claude <noreply@anthropic.com>
1 parent a2e4b76 commit ed4a000

8 files changed

Lines changed: 526 additions & 384 deletions
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
'@object-ui/app-shell': patch
3+
---
4+
5+
refactor(app-shell): the Console `ObjectView`'s view management handlers move into a sibling hook
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
The view-config panel's save and create handlers, the draft field update, view switching, the mobile view switcher registration and the view-tab CRUD callbacks (rename, delete, pin, set default, reorder, configure, add) move verbatim out of `ObjectViewInner` in `views/ObjectView.tsx` into `useObjectViewViewCrud` in `objectViewViewCrud.tsx`. The panel and dialog state stays in the component, which passes every input in and reads the returned handlers. No logic, name or rendered output changes, and the package entry is unchanged.
11+
12+
What to do: nothing.

‎ui/packages/app-shell/src/views/ObjectView.overlayPatchOnly.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ describe('objectui#5233 — what must NOT be narrowed', () => {
308308
*/
309309
describe('objectui#12504 census — the toolbar-to-view write family is retired', () => {
310310
const here = path.dirname(fileURLToPath(import.meta.url));
311-
const objectViewCode = stripComments(['ObjectView.tsx', 'objectViewListRenderer.tsx'].map((file) => readFileSync(path.join(here, file), 'utf8')).join('\n'));
311+
const objectViewCode = stripComments(['ObjectView.tsx', 'objectViewListRenderer.tsx', 'objectViewViewCrud.tsx'].map((file) => readFileSync(path.join(here, file), 'utf8')).join('\n'));
312312
const dataSourceCode = stripComments(
313313
readFileSync(path.join(here, '..', '..', '..', 'types', 'src', 'data.ts'), 'utf8'),
314314
);

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

Lines changed: 43 additions & 372 deletions
Large diffs are not rendered by default.

‎ui/packages/app-shell/src/views/ObjectView.unboundAdapterCall.test.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,10 +188,10 @@ describe('set as default (#4463)', () => {
188188

189189
describe('the detach-then-call pattern stays gone (ratchet)', () => {
190190
it('ObjectView.tsx never assigns an adapter method to a local', () => {
191-
const source = readFileSync(
192-
fileURLToPath(new URL('./ObjectView.tsx', import.meta.url)),
191+
const source = ['./ObjectView.tsx', './objectViewViewCrud.tsx'].map((file) => readFileSync(
192+
fileURLToPath(new URL(file, import.meta.url)),
193193
'utf8',
194-
);
194+
)).join('\n');
195195

196196
// Comments are stripped FIRST, and that is not a detail: the fix's own
197197
// docblock quotes the broken line verbatim to explain it, so a scan over the

‎ui/packages/app-shell/src/views/objectViewViewCrud.tsx‎

Lines changed: 459 additions & 0 deletions
Large diffs are not rendered by default.

‎ui/packages/app-shell/src/views/view-filter-fold.ratchet.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const here = path.dirname(fileURLToPath(import.meta.url));
4343
const objectViewPath = path.join(here, 'ObjectView.tsx');
4444
const widgetsPath = path.join(here, 'metadata-admin/widgets.tsx');
4545

46-
const objectViewSrc = [objectViewPath, path.join(here, 'objectViewListRenderer.tsx')].map((file) => readFileSync(file, 'utf8')).join('\n');
46+
const objectViewSrc = [objectViewPath, path.join(here, 'objectViewListRenderer.tsx'), path.join(here, 'objectViewViewCrud.tsx')].map((file) => readFileSync(file, 'utf8')).join('\n');
4747
const widgetsSrc = readFileSync(widgetsPath, 'utf8');
4848

4949
/**

‎ui/packages/app-shell/src/views/writeRefusalCensus-11583.test.ts‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,32 +88,32 @@ const LEDGER: Row[] = [
8888
reason: 'Issues one `updateView` per patch and hands every promise back; set-as-default and reorder await them and answer for the refusal.',
8989
},
9090
{
91-
file: 'ObjectView.tsx', symbol: 'handleViewConfigSave', callee: 'persistRuntimeMetadata', calls: 1,
91+
file: 'objectViewViewCrud.tsx', symbol: 'handleViewConfigSave', callee: 'persistRuntimeMetadata', calls: 1,
9292
kind: 'surfaces', pin: 'ObjectView.viewWriteRefusal-11583.test.tsx',
9393
reason: 'The view-config panel\'s edit Save: a toast with the door\'s message, and the panel is told the save failed, so it stays dirty (objectui#11583).',
9494
},
9595
{
96-
file: 'ObjectView.tsx', symbol: 'handleViewCreate', callee: 'createRuntimeMetadata', calls: 1,
96+
file: 'objectViewViewCrud.tsx', symbol: 'handleViewCreate', callee: 'createRuntimeMetadata', calls: 1,
9797
kind: 'surfaces', pin: 'ObjectView.createViewRefusal-11578.test.tsx',
9898
reason: 'Create View: a toast with the door\'s message, and the dialog stays open (objectui#11578).',
9999
},
100100
{
101-
file: 'ObjectView.tsx', symbol: 'handleRenameView', callee: 'updateView', calls: 1,
101+
file: 'objectViewViewCrud.tsx', symbol: 'handleRenameView', callee: 'updateView', calls: 1,
102102
kind: 'surfaces', pin: 'ObjectView.viewWriteRefusal-11583.test.tsx',
103103
reason: 'Rename: the translated `objectViewActions.renameFailed` title, with the door\'s message as the description (objectui#12417).',
104104
},
105105
{
106-
file: 'ObjectView.tsx', symbol: 'handleDeleteView', callee: 'deleteView', calls: 1,
106+
file: 'objectViewViewCrud.tsx', symbol: 'handleDeleteView', callee: 'deleteView', calls: 1,
107107
kind: 'surfaces', pin: 'ObjectView.viewWriteRefusal-11583.test.tsx',
108108
reason: 'Delete: the translated `objectViewActions.deleteFailed` title, with the door\'s message as the description (objectui#12398).',
109109
},
110110
{
111-
file: 'ObjectView.tsx', symbol: 'handlePinView', callee: 'updateView', calls: 1,
111+
file: 'objectViewViewCrud.tsx', symbol: 'handlePinView', callee: 'updateView', calls: 1,
112112
kind: 'surfaces', pin: 'ObjectView.viewWriteRefusal-11583.test.tsx',
113113
reason: 'Pin and unpin: a toast with the door\'s message (objectui#11583).',
114114
},
115115
{
116-
file: 'ObjectView.tsx', symbol: 'handleSetDefaultView', callee: 'dispatchViewPatches', calls: 1,
116+
file: 'objectViewViewCrud.tsx', symbol: 'handleSetDefaultView', callee: 'dispatchViewPatches', calls: 1,
117117
kind: 'surfaces', pin: 'ObjectView.viewWriteRefusal-11583.test.tsx',
118118
reason: 'Set as default: a toast with the door\'s message; it was a bare untranslated literal with no description until the objectui#11583 patch round.',
119119
},

‎ui/scripts/__tests__/check-i18n-call-site-keys.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1088,7 +1088,7 @@ export const A = (name: string, label: string, n: number) => {
10881088
"t('marketplace.detail.reseedLocalSuccess', { inserted, updated })",
10891089
],
10901090
[
1091-
'packages/app-shell/src/views/ObjectView.tsx',
1091+
'packages/app-shell/src/views/objectViewViewCrud.tsx',
10921092
// Tight on purpose: the file still holds a legitimate *computed*
10931093
// `defaultValue` ending in the same sentence (line ~1657), and a marker
10941094
// loose enough to catch that one would fail for the wrong reason.

0 commit comments

Comments
 (0)