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

Leaking events when element containing a "BaseExperienceFrame" gets destroyed #227

Open
kfrancois opened this issue Oct 14, 2024 · 1 comment

Comments

@kfrancois
Copy link

Steps to reproduce

  1. Clone and set up https://github.com/kfrancois/repro-amazon-quicksight-embedding-sdk
git clone https://github.com/kfrancois/repro-amazon-quicksight-embedding-sdk.git
npm i
npm start
  1. Plug in your own QSearchBar url here
  2. Wait for the app to load
  3. Click on the "Hide container"-button

Result

Every page click will throw a CLOSE_Q_SEARCH timed out-error.
This is because BaseExperienceFrame adds a mutation observer on the body element, but this mutation observer only checks for node === this.iframe || node === this.container.
Because of this, if the parent element of the container element (or any of its parents) get removed from the DOM, no cleanUpCallbacks actually execute.

This feels like unexpected behaviour as there are leaky object references & event listeners that stay active even after the embedded Quicksight element is destroyed.

@kfrancois
Copy link
Author

Potentially, we could use document.body.contains(node) instead of checking for equality on a removed node, but I'm not sure about possible performance implications here (since we're traversing the DOM on every mutation).

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

No branches or pull requests

1 participant