Repository navigation
fix: preserve Resizable bound migration semantics - #6124
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR Modified ComponentsResizable (@astryxdesign/core) · View in Storybook
Bundle Size Summary
Accessibility AuditStatus: No accessibility violations detected. Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
cixzhang
left a comment
There was a problem hiding this comment.
Semantic verdict: request changes
This still lets a removed bound reach 0.6 and be ignored. RejectRemovedPixelBounds checks keyof Config, but a union exposes only shared keys:
declare const config:
| UseResizableSingleConfig
| (UseResizableSingleConfig & {minSizePx: number});
useResizable(config); // compilesI verified the equivalent nested multi-region union is rejected, but this single-region case compiles: its @ts-expect-error is unused. At runtime 0.6 reads only minSize, so builders can still silently lose the minimum. Please make the rejection distribute across single-config union members and add this factory/union case to the type tests.
[Reviewed by Robohands]
cixzhang
left a comment
There was a problem hiding this comment.
Semantic verdict: request changes
This can still change a builder’s minimum during the 0.6 migration when an inline config uses a computed property:
const key = 'minSize';
useResizable({[key]: 160, minSizePx: 80});0.5 chooses minSize (160) when both spellings are present. This codemod emits {[key]: 160, minSize: 80}, so JavaScript precedence changes the minimum to 80. Please treat computed properties as dynamic, like spreads: leave the object unchanged, add the manual-migration TODO, and cover both property orders plus a nested region.
[Reviewed by Robohands]
cixzhang
left a comment
There was a problem hiding this comment.
Semantic verdict: approve
Builders now get a type error instead of silently losing a removed bound; computed and spread cases stop for manual migration without rewriting precedence. Thanks, this is good.
[Reviewed by Robohands]
One commit, no conflicts: #6124 preserves Resizable bound migration semantics. It touches the Resizable hook, its codemod, and their tests — nothing this branch changes, and nothing under Switch or internal/a11y-spec references useResizable or the pixel-bound options it migrates.
…traint upstream/main (meta#6124) retyped useResizable's overloads as `config: SingleResizableArgument<Config>` / `MultiResizableArgument<Config>`, conditional types deferred on a `const Config extends ...` parameter. asPropBag only unwrapped a bare type parameter, so each parameter read as "not a bag", the entry resolved to an EMPTY contract, and the gate went silently blind to it: the real-core "second useResizable overload" test went red on the merge, and core's report dropped useResizable entirely. - asPropBag reads any deferred generic (type parameter, conditional, indexed access: TypeFlags.InstantiableNonPrimitive) through its base constraint, as it already did for a constrained type parameter. - collectPublicProps skips a key that accepts nothing (`never`, which strict reads as `undefined`): RejectRemovedPixelBounds adds `minSizePx?: never` / `maxSizePx?: never` only so a removed key fails to compile, and documenting them would be wrong. Proof: new fixture test (conditional over a constrained generic plus a `never` key) was red as `expected [] to deeply equal ['leading']`, then `['leading', 'waitMs']` with only the constraint read; green with both. The real useResizable test now also asserts minSizePx is not reported. 106/106. Core: 74 -> 81 undocumented, 0 unresolved; the 7 added are real gaps in Resizable.doc.mjs's useResizable entry (containerRef, defaultIsCollapsed, direction, isCollapsed, onCollapseChange, onSizeChange, regions).
Why
The 0.6 Resizable cleanup could silently drop deprecated bounds passed through assembled objects, and its codemod could change property precedence when an inline configuration contained dynamic properties.
What
Risk
Low. Runtime behavior is unchanged; the correction makes unsupported TypeScript inputs fail loudly and makes ambiguous codemod cases explicit.
Testing
The non-required stable visual job cannot plan shots because Resizable has no seeded visual baseline; this PR changes no rendered output.