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

Created on 26 Jun 2019  路  9Comments  路  Source: uber/baseweb

When opening, clicking and generally using the TimezonePicker the console throws the following error:
Warning: Cannot update during an existing state transition (such as withinrender). 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 |

  • [x] I have searched the issues of this repository and believe that this is not a duplicate.
bug

All 9 comments

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.

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.

This seems to still be an issue and affects quite a lot of components that use Select. Should this not be a pretty high priority bug?

This issue is stale because it has been open 30 days with no activity. If it's still valid, please remove the stale label or comment on the issue, otherwise this ticket will be closed in 5 days

This is still happening rarely I believe. This comment to hope for renewed attention and to ensure the issue doesn't get closed.

This issue is stale because it has been open 30 days with no activity. If it's still valid, please remove the stale label or comment on the issue, otherwise this ticket will be closed in 5 days

This shouldn't have been closed as stale. I'm looking into the problem now. @houmark do you use activedescendantId in your application?

@houmark do you use activedescendantId in your application?

No, I do not. Also, I have not seen this issue pop up recently, which may be because it was inherited from Select which had that issue, but that was solved in this PR.

Sounds good, I think I have a related issue but not quite the same. I'll close this one then to not add noise to the issues

Was this page helpful?
0 / 5 - 0 ratings