question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"Maximum update depth exceeded" error when resizing in Chrome

See original GitHub issue

Hi, We bought 2 license keys and have been enjoying the Fullcalendar library so far. Our project uses the React version v5.3.1 with the Resource Timeline and Timeline plugins.

However today, we noticed that resizing the window leads to an error Maximum update depth exceeded. This reported bug https://github.com/fullcalendar/fullcalendar/issues/5606 mentioned something very similar and was already fixed in v5.2.0.

Reduced Test Case

Code Sandbox reduced test case.

Bug Description

  • using chrome
  • increase/decrease the browser window width
  • notice the app crashing with a Uncaught Error: Maximum update depth exceeded

Screenshots

calendar-crash-on-resize

Thank you.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
mate-hcpcommented, May 13, 2022

@arshaw I can also confirm problem with this (fullcalendar & plugins in newest versions 5.11.0). I was able to debug the code and found this: https://github.com/fullcalendar/fullcalendar-scheduler/blob/master/scrollgrid/src/ClippedScroller.tsx#L93-L97

  componentDidUpdate(prevProps: ClippedScrollerProps) {
    if (!isPropsEqual(prevProps, this.props)) { // an external change?
      this.handleSizing()
    }
  }

This line is doing a lot of re-renders of ClippedScroller component, mostly because isPropsEqual is comparing really big props objects, and it’s returning false even if objects probably should be equal https://github.com/fullcalendar/fullcalendar/blob/master/packages/common/src/util/object.ts#L103-L105

  if (obj0 === obj1) {
    return true
  }

my proposition is to instead comparing whole props, maybe we should compare only those values of those objects which should trigger this.handleSizing()

For example:

componentDidUpdate(prevProps: ClippedScrollerProps) {
  const prevHeight = prevProps.children.props.clientHeight;
  const currentHeight = this.props.children.props.clientHeight;
  const prevWidth = prevProps.children.props.clientWidth;
  const currentWidth = this.props.children.props.clientWidth;

  const isSameHeight = prevHeight === currentHeight;
  const isSameWidth = prevWidth === currentWidth;
  if (!isSameHeight || !isSameWidth) {
    this.handleSizing();
  }
}

this will reduce a lot unnecessary re-renders of ClippedScroller component, and can fix problem with “Maximum update depth exceeded”

1reaction
thomasnegercommented, Nov 13, 2020

Hi @arshaw ! Thanks for the workaround idea. I just updated my CodeSandbox example with latest 5.4.0 https://codesandbox.io/s/pedantic-architecture-o43ni?file=/src/App.js and I can still reproduce it on Chrome. Although I will agree, that the windowResizeDelay prop does somehow mitigate the crash.

I can also understand why this is hard to debug and fix.

In our usage of the Fullcalendar library, we extend each rows with our own components using the eventContent hook. We have ~100 rows, maybe more. I hope that even with lots of components to render on screen and your windowResizeDelay will do the trick.

If not, I’ll probably come back in this thread with an updated reduced test case 😃

Thanks a lot and happy hacking ⌨!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting maximum update depth exceeded on small screen size
Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate.
Read more >
Fix the "Maximum Update Depth Exceeded" Error in React
One quick solution is to move the function inside the useEffect hook. function App() { const [views ...
Read more >
× Unhandled Rejection (Error): Maximum update depth exceeded ...
Error : Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits ...
Read more >
Usage and limits | Firestore - Firebase
Use this guide to understand Cloud Firestore limits, and see Cloud Firestore Pricing for a full, ... Maximum depth of fields in a...
Read more >
@fullcalendar/luxon2 | Yarn - Package Manager
... with expanding height (#5792); fixed: locales not working in IE11 (#6790) ... dateSet, and "Maximum update depth exceeded error" (#5935, react-185) ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found