Skip to content

[toast] Reuse getDisplacement function #4748

Merged
sai6855 merged 3 commits into
mui:masterfrom
sai6855:displacement-fuc
May 5, 2026
Merged

[toast] Reuse getDisplacement function #4748
sai6855 merged 3 commits into
mui:masterfrom
sai6855:displacement-fuc

Conversation

@sai6855
Copy link
Copy Markdown
Member

@sai6855 sai6855 commented May 5, 2026

Although getDisplacement utility isn’t specific to Toast, the logic matches exactly, so I reused it

@sai6855 sai6855 added type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature. component: toast Changes related to the toast component. labels May 5, 2026
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 5, 2026

commit: 510bd95

@code-infra-dashboard
Copy link
Copy Markdown

code-infra-dashboard Bot commented May 5, 2026

Bundle size

Bundle Parsed size Gzip size
@base-ui/react ▼-126B(-0.03%) ▼-41B(-0.03%)

Details of bundle changes

Performance

Total duration: 1,340.65 ms +19.37 ms(+1.5%) | Renders: 53 (+0) | Paint: 2,051.43 ms -3.07 ms(-0.1%)

Test Duration Renders
Menu open (500 items) 87.94 ms 🔺+17.54 ms(+24.9%) 12 (+0)
Menu mount (300 instances) 162.89 ms 🔺+16.91 ms(+11.6%) 2 (+0)
Scroll Area mount (300 instances) 112.95 ms 🔺+11.42 ms(+11.3%) 3 (+0)
Tooltip mount (300 contained roots) 67.11 ms 🔺+6.63 ms(+11.0%) 2 (+0)
Checkbox mount (500 instances) 68.07 ms 🔺+3.55 ms(+5.5%) 1 (+0)

…and 7 more — details


Check out the code infra dashboard for more information about this PR.

@netlify
Copy link
Copy Markdown

netlify Bot commented May 5, 2026

Deploy Preview for base-ui ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 510bd95
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/69f9c7edd1ef3600088d224a
😎 Deploy Preview https://deploy-preview-4748--base-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@sai6855 sai6855 marked this pull request as ready for review May 5, 2026 10:40
@sai6855 sai6855 requested a review from atomiks as a code owner May 5, 2026 10:40
Copilot AI review requested due to automatic review settings May 5, 2026 10:40
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR deduplicates swipe displacement logic in the Toast component by removing a locally-defined getDisplacement helper and reusing the shared implementation from utils/useSwipeDismiss, keeping behavior consistent across swipe-dismiss consumers.

Changes:

  • Import getDisplacement from packages/react/src/utils/useSwipeDismiss.
  • Remove the inline getDisplacement implementation from ToastRoot.tsx.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sai6855 sai6855 changed the title Displacement fuc [toast] Reuse getDisplacement function May 5, 2026
@sai6855 sai6855 merged commit ef092c5 into mui:master May 5, 2026
27 of 28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: toast Changes related to the toast component. type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants