Skip to content

Commit

Permalink
fix(file-item): call IntersectionObserver.unobserve in the right places
Browse files Browse the repository at this point in the history
  • Loading branch information
nd0ut committed Jul 28, 2022
1 parent 7f6977a commit 3216ad7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions blocks/FileItem/FileItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export class FileItem extends UploaderBlock {
let [entry] = entries;
if (entry.isIntersecting && !this.innerHTML) {
this.render();
this._observer?.unobserve(this);
}
if (entry.intersectionRatio === 0) {
clearTimeout(this._thumbTimeoutId);
Expand Down Expand Up @@ -155,7 +156,6 @@ export class FileItem extends UploaderBlock {
if (!uuid) {
return;
}
this._observer.unobserve(this);
this.setAttribute('loaded', '');

if (this.entry.getValue('isImage')) {
Expand Down Expand Up @@ -226,7 +226,7 @@ export class FileItem extends UploaderBlock {

destroyCallback() {
FileItem.activeInstances.delete(this);
// this._observer.unobserve(this);
this._observer?.unobserve(this);
clearTimeout(this._thumbTimeoutId);
}

Expand Down

0 comments on commit 3216ad7

Please sign in to comment.