-
Notifications
You must be signed in to change notification settings - Fork 648
Separate current width from default width in PageLayout.Pane resizable API #7415
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Separate current width from default width in PageLayout.Pane resizable API #7415
Conversation
|
…idth - Update ResizableConfig type to include optional width property for current controlled value - Update PaneWidthValue JSDoc to clarify it defines constraints/defaults only - Update usePaneWidth hook to prioritize resizable.width over default width - Add logic to sync state when resizable.width changes or is removed - Add 6 new tests for resizable.width controlled behavior - Update stories to demonstrate new API pattern with resizable.width - Add new story showing controlled width with new API Co-authored-by: mattcosta7 <[email protected]>
- Improve deprecation notice for direct number width values with migration guidance - Simplify state sync logic by extracting boolean flags for better readability - Add clearer comments explaining when state updates occur Co-authored-by: mattcosta7 <[email protected]>
Co-authored-by: mattcosta7 <[email protected]>
|
👋 Hi, this pull request contains changes to the source code that github/github-ui depends on. If you are GitHub staff, test these changes with github/github-ui using the integration workflow. Or, apply the |
| * - Number: explicit pixel width (uses `minWidth` prop and viewport-based max) | ||
| * - Custom object: `{min: string, default: string, max: string}` | ||
| * - Number: explicit pixel width (uses `minWidth` prop and viewport-based max) | ||
| * **Deprecated**: Direct number values are deprecated. Use `CustomWidthOptions` with `default` property |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need to deprecate we can just remove these since we never used them right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right! Removed the number type entirely since it was never shipped. This simplifies the API and removes the deprecation notice. The changes include:
- Removed
numberfromPaneWidthValueunion type - Removed
isNumericWidthhelper function - Cleaned up JSDoc comments
- Simplified CSS variable logic in PageLayout.tsx
Commit: 80df7ec
As suggested by @mattcosta7, removing the number type entirely instead of deprecating it since it was never part of a public release. This simplifies the API and removes unnecessary complexity. - Remove number from PaneWidthValue union type - Remove isNumericWidth helper function - Clean up related JSDoc comments - Simplify CSS variable assignment in PageLayout.tsx Co-authored-by: mattcosta7 <[email protected]>
3115cac
into
make-primer-react-pagelayout-accept-persister
The
widthprop currently conflates two concepts: named sizes and default constraints. This refactor separates concerns:widthdefines constraints and defaults, whileresizable.widthholds the current controlled value.API Changes
Before (proposed in PR #7348 but never shipped):
After:
Implementation
PersistConfigwith optionalwidth?: numberfor current controlled valueresizable.width→localStorage→width.defaultresizable.widthchanges or is removed, state updates appropriatelyresizable.widthworks unchangednumberfromPaneWidthValueunion type (was never shipped, so no deprecation needed)Changelog
New
resizable.width?: number- Optional property to control current pane widthChanged
widthprop now defines constraints only (named sizes orCustomWidthOptions)usePaneWidthinitialization prioritizesresizable.widthwhen providedRemoved
numbertype fromPaneWidthValue(was never part of a public release)isNumericWidthhelper function (no longer needed)Rollout strategy
Fully backward compatible. Existing APIs continue to work without modification.
Testing & Reviewing
resizable.widthinitialization, updates, and removalMerge checklist
Original prompt
This pull request was created from Copilot chat.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.