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.

[TimezonePicker] Warning: Cannot update during an existing state transition

See original GitHub issue

When opening, clicking and generally using the TimezonePicker the console throws the following error: Warning: Cannot update during an existing state transition (such as within render). Render methods should be a pure function of props and state.

I thought it may be something with my local setup (just testing out BaseWeb and TimezonePicker was my first component to test), but following the link from the docs page to CodeSandbox, the error is also reported in the console there: https://codesandbox.io/s/pulvl?module=/example.js

Expected Behavior

No errors in console.

Your Environment

Tech Version
Base UI v7.8.0
React 16.8.6
browser Chrome 75.x
  • I have searched the issues of this repository and believe that this is not a duplicate.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
houmarkcommented, Jun 27, 2019

I’m not sure this a good first issue anymore 😃

I have a tight deadline, but do plan to collaborate in the future with fixes such as for example the missing error / positive state on some components. Those seem like good first issues, while this one seems to be potentially very breaking for several components that depend on it.

1reaction
jh3ycommented, Jun 27, 2019

I’ve narrowed down the source of the issue here 👍 #1291 introduced a conditional inside getRequiredItemProps of src/menu/stateful-container#L210 that triggers a setState.

This setState is updating the aria-activedescendant on the Menu being used in any Select component. This includes TimezonePicker that uses Select.

This happens on first render as I believe every option is mapped invoking getRequiredItemProps at src/menu/menu#L64.

A solution could potentially be made inside Menu by explicitly updating an element ref attribute instead of triggering an entire state change. This would require an element ref for the List component and potentially a ref for the current activedescendant.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Warning: setState(...): Cannot update during an existing state ...
It looks like the app gets in a loop: Warning: setState(...): Cannot update during an existing state transition (such as within ...
Read more >
Diagnosing React's "Cannot update during an existing state ...
What is the “Cannot update during an existing state transition” error in React? When you try to update state inside of the render()...
Read more >
setState(...): Cannot update during an existing state transition ...
I have a react component which is basically a form that submits a company's data. Everything is okay till I fill the form...
Read more >
setState(…): Cannot update during an existing state transition ...
It looks like the app gets in a loop: Warning: setState(...): Cannot update during an existing state transition (such as within `render` or ......
Read more >
react_bad_update_state - Rule | DeepScan
This rule was introduced in DeepScan 1.3.0-beta. See. React Warning: setState(…): Cannot update during an existing state transition (such as ...
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