-
Notifications
You must be signed in to change notification settings - Fork 409
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
Uncaught Error: flushSync was called from inside a lifecycle method. It cannot be called when React is already rendering #817
Comments
I was inspecting _this in hideMenu and the inputNode can be used to detect if the menu is rendered in the DOM. e.g. if _this.inputNode.offsetParent is undefined it's not rendered. Probably a more standard way of detecting this. |
Hey @duhmojo, thanks for opening this issue, and for the detailed repro steps and additional investigation. It looks like the I plan to drop the |
@ericgio when would v7 come out? I would like to find a way to resolve this issue. Will ignore the warning for now. Thank you for your time. |
I'm going to comment on this issue with my work around. I ignored this for months then had to come back to it. I was able to set a ref for Typeahead, then onBlur get the ref and call hideMenu() to force the menu closed before anything else in the React lifecycle could execute.
I will say that hideMenu was no where in the docs, but was in the reference object and code. |
Version
react-bootstrap-typeahead@6.2.3
Steps to reproduce
Hard to reproduce with an example, but I can try. Basically when using the React Bootstrap Tabs/Tab component, if I stick a Typeahead component inside the tab, then open the dropdown and select another tab, the following blows up in my console:
If I click off to close the dropdown, then switch tabs, no problem. The issue is tried to React rendering or attempting to render visible content that isn't visible/loaded anymore.
Typeahead line 260:
Expected Behavior
Using React Bootstrap Tabs I expect to be able to select another tab when the Typehead dropdown is visible and not have it error.
Actual Behavior
Using React Bootstrap Tabs selecting another tab when the Typehead dropdown is visible throws:
The text was updated successfully, but these errors were encountered: