Skip to content

fix: preserve Resizable bound migration semantics - #6124

Merged
cixzhang merged 4 commits into
mainfrom
fix-resizable-deprecated-bounds-6118
Sep 7, 2026
Merged

cixzhang merged 4 commits into
mainfrom
fix-resizable-deprecated-bounds-6118

Conversation

@cixzhang

@cixzhang cixzhang commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

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

  • Reject removed pixel-bound aliases even when TypeScript excess-property checks or union types would otherwise allow them through variables.
  • Leave inline configurations with spreads or computed properties unchanged and add a manual-migration TODO instead of applying a potentially behavior-changing rewrite.

Risk

Low. Runtime behavior is unchanged; the correction makes unsupported TypeScript inputs fail loudly and makes ambiguous codemod cases explicit.

Testing

  • 157 focused Resizable, ResizeHandle, and next-codemod tests
  • Core and strict CLI typechecks
  • Core build
  • Repository checks and focused lint

The non-required stable visual job cannot plan shots because Resizable has no seeded visual baseline; this PR changes no rendered output.

@vercel

vercel Bot commented Sep 7, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Sep 7, 2026 6:16pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Sep 7, 2026
@cixzhang
cixzhang marked this pull request as ready for review September 7, 2026 17:13
github-actions Bot added a commit that referenced this pull request Sep 7, 2026
@github-actions

github-actions Bot commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

🧪 Sandbox Preview

View Sandbox for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

Modified Components

Resizable (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 1296 -
Complexity N/A Very High (106) -

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@astryxdesign/core N/A 4.8KB 1.2KB

Accessibility Audit

Status: No accessibility violations detected.


Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

@cixzhang cixzhang left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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); // compiles

I 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 cixzhang left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 cixzhang left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]

@cixzhang
cixzhang merged commit 8b6500b into main Sep 7, 2026
29 of 31 checks passed
cixzhang added a commit that referenced this pull request Sep 7, 2026
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.
@github-actions
github-actions Bot deleted the fix-resizable-deprecated-bounds-6118 branch September 8, 2026 06:22
AKnassa added a commit to AKnassa/astryx that referenced this pull request Sep 26, 2026
…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).

This branch was successfully deployed

1 active deployment
Preview — a1649bb2 Deployed Sep 7, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant