Coder Social home page Coder Social logo

Comments (8)

tajbowness avatar tajbowness commented on June 20, 2024

Wrapping the code inside of collapse with Suspense also fixes the issue (lazy, i guess). But you don't get the very first transition, instead its pop ups. The issue seems to be caused by lazy.

from material-ui.

aarongarciah avatar aarongarciah commented on June 20, 2024

Lazy loading is also likely another reason why this issue is occuring. But for my project it's necessary otherwise, I'd get these prompts

@tajbowness are you receiving these errors for all components or only those coming from @mui/material? I'd recommend looking for the root cause.

I've been testing a bit and this is the summary is:

  • The issue happens with the combination of lazy (without Suspense) + unmounOnExit.
  • Wrapping lazy-loaded components with Suspense makes the issue disappear but the initial transition is lost.
  • unmountOnExit with regularly loaded components works fine.
  • The error is thrown in the Transition component from the react-transition-group, which Collapse uses under the hood. Unclear what causes it.

I'd always recommend wrapping lazy-loaded components in Suspense, especially the ones displayed after user interaction. See this example adapted from the React docs.

I think we should focus on a more realistic scenario like this one I adapted from your demo: playground. Collapse wraps a lazy-loaded component wrapped in Suspense. The problem in this case is that the transition doesn't work when the component is lazy-loaded for the first time.

@siriwatknp @DiegoAndai do you remember similar issues with Material UI transition components?

from material-ui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.