Skip to content

[Dialog] Fix Maximum update depth exceeded error with Suspense#3700

Merged
michaldudak merged 4 commits intomui:masterfrom
michaldudak:fix-dialog-portal-suspense
Jan 8, 2026
Merged

[Dialog] Fix Maximum update depth exceeded error with Suspense#3700
michaldudak merged 4 commits intomui:masterfrom
michaldudak:fix-dialog-portal-suspense

Conversation

@michaldudak
Copy link
Copy Markdown
Member

@michaldudak michaldudak commented Jan 7, 2026

Adjusted the portal node ref handling in FloatingPortal to avoid state updates during ref cleanup, which prevents the Suspense hide/show loop while still clearing the portal node via container changes.

Also added a missing open state getter in DialogPortal.

Fixes #3695

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Jan 7, 2026

  • vite-css-base-ui-example

    pnpm add https://pkg.pr.new/mui/base-ui/@base-ui/react@3700
    
    pnpm add https://pkg.pr.new/mui/base-ui/@base-ui/utils@3700
    

commit: 055ae56

@mui-bot
Copy link
Copy Markdown

mui-bot commented Jan 7, 2026

Bundle size report

Bundle Parsed size Gzip size
@base-ui/react 🔺+43B(+0.01%) 🔺+24B(+0.02%)

Details of bundle changes


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

@netlify
Copy link
Copy Markdown

netlify bot commented Jan 7, 2026

Deploy Preview for base-ui ready!

Name Link
🔨 Latest commit 055ae56
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/695f5eefd985ea0007573790
😎 Deploy Preview https://deploy-preview-3700--base-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

@michaldudak michaldudak added type: bug It doesn't behave as expected. component: dialog Changes related to the dialog component. labels Jan 7, 2026
@michaldudak michaldudak force-pushed the fix-dialog-portal-suspense branch from 78ae150 to 3a07365 Compare January 7, 2026 14:15
@michaldudak michaldudak force-pushed the fix-dialog-portal-suspense branch from 3a07365 to 6933775 Compare January 7, 2026 14:16
Copy link
Copy Markdown
Member

@mj12albert mj12albert left a comment

Choose a reason for hiding this comment

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

It fixes the issue in the repro: https://codesandbox.io/p/sandbox/base-ui-dialog-suspense-forked-4gnszf

But the new tests need to be skipped for React 18:
Screenshot 2026-01-08 at 3 06 36 PM

@michaldudak
Copy link
Copy Markdown
Member Author

I actually updated the test to use React.lazy instead of React.use as it also suspends and is available in React 18.

@michaldudak michaldudak changed the title [Dialog] Fix Maximum update depth exceeded [Dialog] Fix Maximum update depth exceeded error with Suspense Jan 8, 2026
@michaldudak michaldudak merged commit 105e8f6 into mui:master Jan 8, 2026
23 checks passed
@michaldudak michaldudak deleted the fix-dialog-portal-suspense branch January 8, 2026 07:45
atomiks pushed a commit to atomiks/base-ui that referenced this pull request Jan 14, 2026
@Tiedye
Copy link
Copy Markdown

Tiedye commented Jan 21, 2026

Thank you so much, this was killing me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: dialog Changes related to the dialog component. type: bug It doesn't behave as expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[dialog] Suspense across portal causes "Maximum update depth exceeded." error

4 participants