mui / mui/material-ui

[Dialog]: Not opened dialog renders when it's wrapped in Suspense component

Open
#33,748 7 comments 4 reactions 1 assignee View on GitHub

@siriwatknp is already working on this.

Since Aug 22, 2022.

scope: dialog
Dominant language
JavaScript
Stars
99.1k
Forks
32.5k
Avg merge
2d 17h
Merged PRs (30d)
106

Description

Duplicates
  • I have searched the existing issues
Latest version
  • I have tested the latest version
Current behavior 😯

Hi there,

I have two related dialogs wrapped in React Suspense component and there is a component triggers suspense inside second dialog. Both dialogs are rendered in that case even if the open prop is false.

Please see Codesandbox example to see details.
Thanks

Expected behavior 🤔

All dialogs with falsy open props should not be rendered

Steps to reproduce 🕹

No response

Context 🔦

No response

Your environment 🌎
npx @mui/envinfo
  System:
    OS: macOS 11.6.4
  Binaries:
    Node: 18.0.0 - /usr/local/bin/node
    Yarn: 1.22.19 - ~/.yarn/bin/yarn
    npm: 8.6.0 - /usr/local/bin/npm
  Browsers:
    Chrome: 103.0.5060.134
    Edge: Not Found
    Firefox: 92.0
    Safari: 15.3
  npmPackages:
    @emotion/react: ^11.9.0 => 11.9.3 
    @emotion/styled: ^11.8.1 => 11.9.3 
    @mui/base:  5.0.0-alpha.91 
    @mui/icons-material: ^5.8.4 => 5.8.4 
    @mui/lab: ~5.0.0-alpha.91 => 5.0.0-alpha.92 
    @mui/material: ~5.9.1 => 5.9.2 
    @mui/private-theming:  5.9.1 
    @mui/styled-engine:  5.8.7 
    @mui/system:  5.9.2 
    @mui/types:  7.1.5 
    @mui/utils:  5.9.1 
    @types/react: ^18.0.9 => 18.0.15 
    react: ^18.1.0 => 18.2.0 
    react-dom: ^18.1.0 => 18.2.0 
    typescript: ^4.7.3 => 4.7.4 

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.