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

dom-repeat keeps running asynchronous code after detached if chunking is enabled. #5667

Closed
1 of 6 tasks
rubenlg opened this issue Jul 1, 2020 · 0 comments · Fixed by #5668
Closed
1 of 6 tasks

dom-repeat keeps running asynchronous code after detached if chunking is enabled. #5667

rubenlg opened this issue Jul 1, 2020 · 0 comments · Fixed by #5668

Comments

@rubenlg
Copy link

rubenlg commented Jul 1, 2020

Description

When dom-repeat is used with chunked rendering, it schedules a requestAnimationFrame which is not cancelled when the element is disconnected from the DOM. As a result, even after the component is detached from the DOM, it keeps running code.

Live Demo

https://jsbin.com/sirelojane/1/edit?html,console,output

Steps to Reproduce

Run the script, look at the console.

Expected Results

No RAF should have been printed after the component is detached

Actual Results

There is at least a couple more.

Browsers Affected

  • Chrome
  • Firefox
  • Edge
  • Safari 11
  • Safari 10
  • IE 11

I only tested on Chrome, but looking at the implementation of dom-repeat it should affect all of them.

Versions

  • Polymer: 2.8.0 and 3.4.1
  • webcomponents: v1

Potential fix

Adding cancelAnimationFrame(this.__chunkingId); to disconnectedCallback in dom-repeat.js seems to resolve the issue, but I don't know what other consequences that could have.

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

Successfully merging a pull request may close this issue.

2 participants