Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: [Dropdown] Uncaught Error: Maximum update depth exceeded. #17897

Closed
2 tasks done
nmgokhale opened this issue Oct 28, 2024 · 0 comments · Fixed by #17952
Closed
2 tasks done

[Bug]: [Dropdown] Uncaught Error: Maximum update depth exceeded. #17897

nmgokhale opened this issue Oct 28, 2024 · 0 comments · Fixed by #17952
Assignees

Comments

@nmgokhale
Copy link

Package

@carbon/react

Browser

Chrome

Package version

v1.68.0

React version

v18.2.0

Description

We started seeing error Uncaught Error: Maximum update depth exceeded. in our application when changing dropdown menu options. Following screen recording shows the error in our application -

Error.in.elyra.canvas.mov
Uncaught Error: 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.

we recently added this code -

<Dropdown
	itemToElement={this.renderItem}
	renderSelectedItem={this.renderItem}
/>

I am seeing renderItem() is called multiple times when I hover over dropdown menu options and also when I select new dropdown options.
Wondering if the error is caused due to so many calls to the renderItem() method?

Reproduction/example

https://stackblitz.com/edit/github-enf21q?file=src%2FApp.jsx

Steps to reproduce

Suggested Severity

Severity 1 = Must be fixed ASAP. The response must be swift. Someone from the team must drop all current work and be immediately reassigned to address the issue.

Application/PAL

No response

Code of Conduct

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants