Skip to content

Commit bc1ec54

Browse files
os-zhuangclaude
andauthored
fix(components,app-shell): the last two direction props follow v4's rename to orientation (#3025)
react-resizable-panels v4 renamed `PanelGroup`'s `direction` prop to `orientation`. Two call sites were still passing the v3 name, so v4 ignored it and React forwarded the unknown prop to the DOM as a stray `direction="horizontal"` attribute on the group div. Both groups are horizontal-only and `horizontal` is v4's default, so nothing rendered wrong — this is dead-prop cleanup, the tail of the migration whose visible half was #3024. Each site also carried `const PanelGroup = ResizablePanelGroup as React.FC<any>`, and those casts are why the dead prop survived the v4 bump: they erased the props to `any`, so `direction` type-checked against nothing. Both comments blamed the toolchain — vite-plugin-dts "not resolving the direction prop type correctly", and a prop that "does not always narrow cleanly in our TS config" — but neither was a narrowing problem. `GroupProps` simply has no `direction` key in v4. Dropping the casts makes the rename self-enforcing: restoring `direction` on the un-cast `ResizablePanelGroup` now fails with TS2322 rather than silently reaching the DOM. ResourceEditPage's `ResizablePanel` props are unaffected — `panelRef`, `collapsible`, `collapsedSize` and `onResize` are all valid v4 `PanelProps` and were never covered by the cast (it only ever wrapped the group), so no narrowly-typed workaround is needed. Co-authored-by: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
1 parent bf66b70 commit bc1ec54

2 files changed

Lines changed: 5 additions & 14 deletions

File tree

packages/app-shell/src/views/metadata-admin/ResourceEditPage.tsx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,6 @@ import { describeIssuePath } from './issuePath';
117117
import { buildCreateModeBody } from './createBody';
118118
import { errorCodeIs, errorCodeIsAnyOf } from '@object-ui/types';
119119

120-
// react-resizable-panels' `direction` prop type does not always narrow
121-
// cleanly in our TS config; cast at the boundary (precedent:
122-
// packages/components/src/custom/navigation-overlay.tsx).
123-
const PanelGroup = ResizablePanelGroup as React.FC<any>;
124-
125120
/**
126121
* Metadata types whose canvas IS the primary create-time authoring
127122
* surface, so we render the preview/inspector split during create
@@ -2060,8 +2055,8 @@ function MetadataResourceEditPageImpl({
20602055
: 'relative flex-1 min-h-0 flex'
20612056
}
20622057
>
2063-
<PanelGroup
2064-
direction="horizontal"
2058+
<ResizablePanelGroup
2059+
orientation="horizontal"
20652060
className="flex-1 min-h-0 rounded-md border bg-background overflow-hidden"
20662061
id={`metadata-edit-${type}`}
20672062
>
@@ -2336,7 +2331,7 @@ function MetadataResourceEditPageImpl({
23362331
</div>
23372332
</div>
23382333
</ResizablePanel>
2339-
</PanelGroup>
2334+
</ResizablePanelGroup>
23402335
{/* The floating reopen pill that used to live here was
23412336
removed: the canvas toolbar already hosts a permanent
23422337
VSCode-style inspector toggle next to the fullscreen

packages/components/src/custom/navigation-overlay.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -460,12 +460,8 @@ export const NavigationOverlay: React.FC<NavigationOverlayProps> = ({
460460
: 40;
461461
const mainPercent = 100 - detailPercent;
462462

463-
// Cast needed: ResizablePanelGroup has correct runtime behavior but
464-
// vite-plugin-dts may not resolve the direction prop type correctly
465-
const PanelGroup = ResizablePanelGroup as React.FC<any>;
466-
467463
return (
468-
<PanelGroup direction="horizontal" className={cn('h-full', className)}>
464+
<ResizablePanelGroup orientation="horizontal" className={cn('h-full', className)}>
469465
<ResizablePanel defaultSize={mainPercent} minSize={30}>
470466
{mainContent}
471467
</ResizablePanel>
@@ -501,7 +497,7 @@ export const NavigationOverlay: React.FC<NavigationOverlayProps> = ({
501497
{renderContent(selectedRecord)}
502498
</div>
503499
</ResizablePanel>
504-
</PanelGroup>
500+
</ResizablePanelGroup>
505501
);
506502
}
507503

0 commit comments

Comments
 (0)