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

Popover doesn't clean up immediately after unmount #2604

Closed
dgieselaar opened this issue Dec 9, 2019 · 0 comments · Fixed by #2614
Closed

Popover doesn't clean up immediately after unmount #2604

dgieselaar opened this issue Dec 9, 2019 · 0 comments · Fixed by #2614
Assignees

Comments

@dgieselaar
Copy link
Member

I've recently started seeing warnings in our APM tests that use the EUIPopover component:

  console.error ../node_modules/react-dom/cjs/react-dom.development.js:530
    Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method.
        in EuiPopover (created by TransactionActionMenu)
        in TransactionActionMenu

I know that React was upgraded recently (439708a6f9), this might be why we're just seeing them now. The warning only shows when multiple tests are ran successively (I'm honestly not sure why).

I've looked into the EUIPopover component and it looks like some of the timeouts are not cleared after unmounting, which leads to the aforementioned warning:

  1. setTimeout(() => {
    this.setState({ isOpenStable: true }, () => {
    this.positionPopoverFixed();
    this.updateFocus();
    });
    }, durationMatch + delayMatch);
  2. window.requestAnimationFrame(() => {
    this.setState({
    isOpening: true,
    });
    });

It's relatively innocent, and I don't think it's a memory leak, but it would be nice to prevent the warning without having to await a timeout in our tests.

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

Successfully merging a pull request may close this issue.

2 participants