BREAKING: Streamline PageLayout.Pane resizable API#7418
BREAKING: Streamline PageLayout.Pane resizable API#7418Copilot wants to merge 5 commits intomake-primer-react-pagelayout-accept-persisterfrom
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 <8616962+mattcosta7@users.noreply.github.com>
- 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 <8616962+mattcosta7@users.noreply.github.com>
|
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] <198982749+Copilot@users.noreply.github.com> Co-authored-by: mattcosta7 <8616962+mattcosta7@users.noreply.github.com>
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.