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.

Forced scrollable Tabs nested in Toolbar causes 'Maximum update depth exceeded.' error

See original GitHub issue

When adding forced scrollable Tabs as children of the Toolbar component an Invariant Violation occurs.

The following error output is from the Link: codesandbox example:

https://m9v2919yop.codesandbox.io/node_modules/fbjs/lib/invariant.js:42:15
scheduleWork$1
https://m9v2919yop.codesandbox.io/node_modules/react-dom/cjs/react-dom.development.js:16222:11
Object.enqueueSetState
https://m9v2919yop.codesandbox.io/node_modules/react-dom/cjs/react-dom.development.js:11300:5
Tabs.Component.setState
https://m9v2919yop.codesandbox.io/node_modules/react/cjs/react.development.js:270:16
    at Tabs._this.updateScrollButtonState (https://m9v2919yop.codesandbox.io/node_modules/
material-ui/core/Tabs/Tabs.js:257:17
    at Tabs.componentDidUpdate (https://m9v2919yop.codesandbox.io/node_modules/
material-ui/core/Tabs/Tabs.js:288:12
commitLifeCycles
https://m9v2919yop.codesandbox.io/node_modules/react-dom/cjs/react-dom.development.js:14370:22
commitAllLifeCycles
https://m9v2919yop.codesandbox.io/node_modules/react-dom/cjs/react-dom.development.js:15463:7
HTMLUnknownElement.callCallback
https://m9v2919yop.codesandbox.io/node_modules/react-dom/cjs/react-dom.development.js:100:14
Object.invokeGuardedCallbackDev
https://m9v2919yop.codesandbox.io/node_modules/react-dom/cjs/react-dom.development.js:138:16
invokeGuardedCallback
https://m9v2919yop.codesandbox.io/node_modules/react-dom/cjs/react-dom.development.js:187:29
commitRoot
https://m9v2919yop.codesandbox.io/node_modules/react-dom/cjs/react-dom.development.js:15604:7
completeRoot
https://m9v2919yop.codesandbox.io/node_modules/react-dom/cjs/react-dom.development.js:16619:34
performWorkOnRoot
https://m9v2919yop.codesandbox.io/node_modules/react-dom/cjs/react-dom.development.js:16564:9
performWork
https://m9v2919yop.codesandbox.io/node_modules/react-dom/cjs/react-dom.development.js:16483:7
performSyncWork
https://m9v2919yop.codesandbox.io/node_modules/react-dom/cjs/react-dom.development.js:16455:3
requestWork
https://m9v2919yop.codesandbox.io/node_modules/react-dom/cjs/react-dom.development.js:16355:5
scheduleWork$1
https://m9v2919yop.codesandbox.io/node_modules/react-dom/cjs/react-dom.development.js:16219:11
Object.enqueueSetState
https://m9v2919yop.codesandbox.io/node_modules/react-dom/cjs/react-dom.development.js:11300:5
Tabs.Component.setState
https://m9v2919yop.codesandbox.io/node_modules/react/cjs/react.development.js:270:16
    at Tabs._this.updateScrollButtonState (https://m9v2919yop.codesandbox.io/node_modules/
material-ui/core/Tabs/Tabs.js:257:17
    at eval (https://m9v2919yop.codesandbox.io/node_modules/
material-ui/core/Tabs/Tabs.js:127:13
later
https://m9v2919yop.codesandbox.io/node_modules/debounce/index.js:28:23
  • This is a v1.x issue.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior

Able to add forced scrollable Tabs as a child of the Toolbar component without Invariant error.

Current Behavior

When clicking through the scroll buttons and tabs the browser becomes unresponsive and throws the following error:

Invariant Violation 
Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside
componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent
infinite loops.

Steps to Reproduce

Link: codesandbox example

This bug is consistently reproducible but the exact number of steps is unpredictable. Within the codesandbox.io example using Chrome

  1. Click a scroll button
  2. Click a few tabs
  3. Click the other scroll button
  4. Click a few tabs
  5. Repeat until the error is thrown. It usually only takes a few cycles.

Context

I am trying to add forced scrollable Tabs to my applications Toolbar component.

Your Environment

Tech Version
Material-UI v1.5.0
React v16.3.2
browser Chrome Version 68.0.3440.106 (Official Build) (64-bit)

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:14 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
joshwoodingcommented, Jan 24, 2019

I’m closing this as a duplicate of #13699. This should now be fixed.

1reaction
murugarathamcommented, Oct 17, 2018

@Quantumplation in short, i had a bad push which caused the “tab contents” to exceed the “tab container”, which caused updateScrollButtonState to keep attempting to recalculate whether or not to show the left and right buttons.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Forced scrollable Tabs nested in Toolbar causes 'Maximum ...
Invariant Violation Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or ...
Read more >
React getting Maximum update depth exceeded error
Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate.
Read more >
PySimpleGUI
PSG solved the GUI problem, but you still have to make an application ... Note that the default max number of lines before...
Read more >
ScrollView - Android Developers
android:animateLayoutChanges, Defines whether changes in layout (caused by adding and ... React to the successful claiming of a nested scroll operation.
Read more >
Lightning Aura Components Developer Guide
we showed you how to surface a component via a tab in Lightning Experience and the Salesforce app, you can take this tutorial...
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