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]: Multiselect drop down throwing browser console error while selecting the value first time #15758

Closed
1 of 2 tasks
ambrishsinghibm opened this issue Feb 15, 2024 · 4 comments · Fixed by #15818
Closed
1 of 2 tasks
Labels

Comments

@ambrishsinghibm
Copy link

Package

@carbon/react

Browser

Chrome, Firefox

Package version

v1.49.0

React version

v18.2.0

Description

Multiselect dropdown throwing browser console error while selecting the value the first time
Error Details:
App.jsx:13 Warning: Cannot update a component (App) while rendering a different component (MultiSelect). To locate the bad setState() call inside MultiSelect, follow the stack trace as described in https://reactjs.org/link/setstate-in-render at https://githubbs1zsv-faiz--5173--a9c8a5a3.local-credentialless.webcontainer.io/node_modules/.vite/deps/@carbon_react.js?v=703ae265:97328:16 at div at App (https://githubbs1zsv-faiz--5173--a9c8a5a3.local-credentialless.webcontainer.io/src/App.jsx:22:49)

Screenshot:
image

I have reproduced this issue here
https://stackblitz.com/edit/github-bs1zsv?file=src%2Findex.scss,src%2FApp.jsx&preset=node=

Reproduction/example

https://stackblitz.com/edit/github-bs1zsv?file=src%2Findex.scss,src%2FApp.jsx&preset=node=

Steps to reproduce

  1. Open URL:https://stackblitz.com/edit/github-bs1zsv?file=src%2Findex.scss,src%2FApp.jsx&preset=node=
  2. Open the console tab in the developer tool
  3. Select the value from the multi-select dropdown
  4. When we select the 1st value, throw console error "Bad setState inside the Multiselect"

Suggested Severity

Severity 2 = User cannot complete task, and/or no workaround within the user experience of a given component.

Application/PAL

I am using React carbon component

Code of Conduct

@mHuzefa
Copy link
Contributor

mHuzefa commented Feb 23, 2024

Hey @alisonjoseph, I have attached the PR for fix. Please assign this issue to me 😃

@ambrishsinghibm
Copy link
Author

ambrishsinghibm commented Mar 28, 2024

@tw15egan I have updated the library in my app and on selection consol issue is fixed but now seeing issue related to defaulted selected items. it's not updating the selected count and default value is not selected. its showing unchecked into the multiselect drop-down. Kindly look into the issue

CC: @alisonjoseph @mHuzefa

@tw15egan
Copy link
Member

@ambrishsinghibm can you please create a new issue with a link to a reproduction of the error? Thanks!

@ychavoya
Copy link
Contributor

ychavoya commented Apr 3, 2024

Hi @tw15egan, I think I found the same issue as @ambrishsinghibm, I created #16124

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

Successfully merging a pull request may close this issue.

5 participants