-
Notifications
You must be signed in to change notification settings - Fork 648
BREAKING: Streamline PageLayout.Pane resizable API #7418
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
base: make-primer-react-pagelayout-accept-persister
Are you sure you want to change the base?
BREAKING: Streamline PageLayout.Pane resizable API #7418
Conversation
🦋 Changeset detectedLatest commit: 713faab The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
- Add useLocalStoragePaneWidth hook for localStorage persistence - Rename width prop to defaultWidth - Add new width prop for controlled current width (number only) - Add onWidthChange callback prop - Add maxWidth prop (number) - Change resizable to boolean only - Remove widthStorageKey prop - Update usePaneWidth hook to usePaneWidthV2 for new API - Update types and exports - Update feature stories to use new API - Add story demonstrating useLocalStoragePaneWidth hook Co-authored-by: mattcosta7 <[email protected]>
- Add comprehensive tests for usePaneWidthV2 (17 tests) - Add comprehensive tests for useLocalStoragePaneWidth (14 tests) - Fix defaultWidth sync logic in usePaneWidthV2 - Create detailed changeset with migration guide - All tests passing Co-authored-by: mattcosta7 <[email protected]>
|
CustomWidthSizeOptions should be replaced with minWidrh, defaultWidth, max width We should avoid duplicating props These are minWidth, defaultWidth, maxWidth constraints. Then current width (when resizable) is width. Resizable is a boolean |
Confirmed - the implementation already matches this specification exactly: Props structure (commit 7ac63ce):
Removed:
The breaking changes API is ready as specified. |
|
👋 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 |
…p validation (#7419) Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: mattcosta7 <[email protected]>
Refactors PageLayout.Pane to follow standard React controlled component patterns, eliminating hydration issues and complex union types.
Changelog
New
useLocalStoragePaneWidth(key, options)hook for SSR-safe localStorage persistencedefaultPaneWidthexport with preset values{small: 256, medium: 296, large: 320}widthprop (number) - controlled current widthonWidthChangecallback propdefaultWidthprop (number | named size) - initial widthmaxWidthprop (number) - maximum constraintChanged
resizablenow accepts boolean only (wasboolean | PersistConfig)widthrenamed todefaultWidth(breaking)Removed
widthStorageKeyprop (useuseLocalStoragePaneWidthhook instead)CustomWidthOptionstype (use separateminWidth/maxWidthprops)PersistConfig,PersistFunction,SaveOptionstypesAPI Comparison
Before:
After:
Rollout strategy
Migration:
No persistence: No changes needed
localStorage: Use hook
Custom constraints: Separate props
Custom persistence: Standard controlled pattern
Testing & Reviewing
Stories demonstrate all patterns: no persistence, localStorage via hook, controlled with constraints, and custom persistence.
Merge checklist
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.