Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 13, 2026

Refactors PageLayout.Pane resizable configuration to use separate onWidthChange callback and currentWidth props, and simplifies resizable to a boolean.

Before:

<PageLayout.Pane
  resizable={{
    width: currentWidth,
    persist: (width) => setCurrentWidth(width)
  }}
/>

After:

<PageLayout.Pane
  resizable
  currentWidth={currentWidth}
  onWidthChange={setCurrentWidth}
/>

Changelog

New

  • PageLayout.Pane: currentWidth?: number prop for controlled width
  • PageLayout.Pane: onWidthChange?: (width: number) => void callback for width changes

Changed

  • resizable prop simplified to: boolean | undefined (no longer accepts configuration objects)
  • When onWidthChange is provided, it takes precedence over localStorage persistence

Removed

  • resizable.width property (replaced by currentWidth prop)
  • PersistConfig type and configuration object pattern {persist: false | 'localStorage' | fn}
  • PersistFunction and SaveOptions types
  • isPersistConfig, isCustomPersistFunction, and isResizableEnabled helper functions

Rollout strategy

  • Patch release
  • Minor release
  • Major release; if selected, include a written rollout or migration plan
  • None; if selected, include a brief description as to why

Rationale: Adds new props and simplifies the API. Maintains backward compatibility for resizable={true} but removes the configuration object pattern in favor of the simpler onWidthChange prop for custom persistence.

Testing & Reviewing

  • Stories updated to demonstrate controlled component pattern with currentWidth + onWidthChange
  • Test coverage includes onWidthChange precedence over localStorage
  • Verify resizable panes work with and without onWidthChange
  • 54 unit tests passing (22 tests removed related to deprecated configuration objects)

Merge checklist


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@changeset-bot
Copy link

changeset-bot bot commented Jan 13, 2026

⚠️ No Changeset found

Latest commit: 1ffd338

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions github-actions bot added the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Jan 13, 2026
@github-actions
Copy link
Contributor

👋 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 integration-tests: skipped manually label to skip these checks.

- Remove width from PersistConfig (no longer in resizable object)
- Add onWidthChange callback prop to PageLayout.Pane
- Add currentWidth prop to PageLayout.Pane for controlled width
- Update usePaneWidth to accept onWidthChange and currentWidth
- When onWidthChange is provided, it's called instead of any persistence
- When currentWidth is provided, it overrides default width
- Update stories to use new API pattern
- Update tests to use currentWidth prop instead of resizable.width
- All 73 tests passing

Co-authored-by: mattcosta7 <8616962+mattcosta7@users.noreply.github.com>
Copilot AI and others added 2 commits January 13, 2026 16:56
- Add 3 new tests for onWidthChange behavior
- Test that onWidthChange is called instead of localStorage
- Test that onWidthChange takes precedence over custom persist
- Test that errors from onWidthChange are handled gracefully
- Fix TypeScript error in test for removing currentWidth prop
- All 76 tests passing, build succeeds

Co-authored-by: mattcosta7 <8616962+mattcosta7@users.noreply.github.com>
Co-authored-by: mattcosta7 <8616962+mattcosta7@users.noreply.github.com>
Copilot AI changed the title [WIP] Add custom persistence options to PageLayout.Pane Refactor PageLayout.Pane resizable API: separate onWidthChange and currentWidth props Jan 13, 2026
@github-actions github-actions bot temporarily deployed to storybook-preview-7449 January 13, 2026 17:00 Inactive
Copilot AI requested a review from mattcosta7 January 13, 2026 17:00
@github-actions github-actions bot temporarily deployed to storybook-preview-7449 January 13, 2026 17:51 Inactive
Comment on lines 58 to 60
* - `{persist: false}`: Enable resizing without any persistence
* - `{persist: 'localStorage'}`: Enable resizing with localStorage persistence (explicit)
* - `{persist: fn}`: Enable resizing with custom persistence function
Copy link
Contributor

Choose a reason for hiding this comment

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

@copilot we should remove these options now for resizable, which is only a boolean or undefind now

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Simplified resizable to just boolean | undefined in commit 1ffd338.

Removed:

  • PersistConfig, PersistFunction, SaveOptions types
  • isPersistConfig, isCustomPersistFunction, isResizableEnabled helpers
  • 22 tests related to persist config options

The API is now simpler:

  • resizable={true} - Enable resizing with localStorage (if no onWidthChange)
  • resizable={false} or omit - Disable resizing
  • Use onWidthChange prop for custom persistence instead of {persist: fn}

- Change ResizableConfig from `boolean | PersistConfig` to `boolean | undefined`
- Remove PersistConfig, PersistFunction, SaveOptions types
- Remove isPersistConfig, isCustomPersistFunction, isResizableEnabled helpers
- Simplify usePaneWidth logic to only handle boolean resizable
- Update PageLayout.Pane docs to reflect simpler API
- Update story using {persist: false} to just use resizable
- Remove tests for PersistConfig and custom persist functions
- Update remaining tests to use boolean resizable
- Remove exports of removed types from index.ts
- All 54 tests passing, build succeeds

Co-authored-by: mattcosta7 <8616962+mattcosta7@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants