Infinite render loop with Gatsby
See original GitHub issueSubject of the issue
Hey,
I’ve posted this https://github.com/gatsbyjs/gatsby/issues/20942 too but the issue is likely caused here as it doesn’t happen with normal gatsby components.
Changing anything in the index.mdx in your example here once it’s running in the browser causes an infinite render loop in MDXProvider
: https://github.com/mdx-js/mdx/tree/master/examples/syntax-highlighting
Here’s a repro but it’s essentially the same as your example with a couple of unnecessary things like unify-ui removed, same issue happens in either: https://github.com/DominicTobias/mdx-infinite-render-loop
Your environment
- OS: MacOS Catalina
- Packages: Latest Gatsby and your packages as per repo provided
- Env: Latest yarn, latest Node LTS (v12)
Steps to reproduce
Repro: https://github.com/DominicTobias/mdx-infinite-render-loop
yarn start
- Open up browser and observe this page:
- Go to
index.mdx
and change anything for examplepadding: "20px",
->padding: "21px",
- Observe infinite render loop in browser:
Issue does not happen if <LivePreview />
isn’t rendered
Expected behaviour
Should update the browser with changes without going into an infinite render loop causing CPU overload
Actual behaviour
Infinitely renders MDXProvider until the browser is refreshed
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (2 by maintainers)
Top GitHub Comments
@farism did you figure it out? Haven’t used Gatsby for a while and set up a new doc site using
gatsby-theme-apollo-docs
. Was working fine for a while now it does it only on .mdx pages on changes and I have to browse to a .md page every time to stop it from infinitely reloading the page. Triedgatsby clean
and fresh node_modules install etc.Only does it on pages where I have live examples, so something about rendering a React component does it, or perhaps something to do with the fact the component I’m rendering is yarn linked.
fwiw, this isn’t strangeness only reproducible by you @DominicTobias. Myself and a colleague are working on converting our doc site to gatsby and we are both encountering the same issue. I also see it on the codesandbox in chrome. Maybe we should reopen this?