mirror of
https://github.com/transloadit/uppy.git
synced 2026-01-23 02:25:07 +00:00
properly remove event listener for "focus" and "click" (#6116)
fix https://github.com/transloadit/uppy/issues/6115 --------- Co-authored-by: Mikael Finstad <finstaden@gmail.com>
This commit is contained in:
parent
23186da45d
commit
6975782339
2 changed files with 15 additions and 2 deletions
5
.changeset/nine-goats-attend.md
Normal file
5
.changeset/nine-goats-attend.md
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
"@uppy/dashboard": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Remove event listener for `focus` and `click`, preventing a memory leak.
|
||||||
|
|
@ -1028,8 +1028,16 @@ export default class Dashboard<M extends Meta, B extends Body> extends UIPlugin<
|
||||||
this.uppy.off('files-added', this.#generateLargeThumbnailIfSingleFile)
|
this.uppy.off('files-added', this.#generateLargeThumbnailIfSingleFile)
|
||||||
this.uppy.off('file-removed', this.#generateLargeThumbnailIfSingleFile)
|
this.uppy.off('file-removed', this.#generateLargeThumbnailIfSingleFile)
|
||||||
|
|
||||||
document.removeEventListener('focus', this.recordIfFocusedOnUppyRecently)
|
document.removeEventListener(
|
||||||
document.removeEventListener('click', this.recordIfFocusedOnUppyRecently)
|
'focus',
|
||||||
|
this.recordIfFocusedOnUppyRecently,
|
||||||
|
true,
|
||||||
|
)
|
||||||
|
document.removeEventListener(
|
||||||
|
'click',
|
||||||
|
this.recordIfFocusedOnUppyRecently,
|
||||||
|
true,
|
||||||
|
)
|
||||||
|
|
||||||
if (this.opts.inline) {
|
if (this.opts.inline) {
|
||||||
this.el!.removeEventListener('keydown', this.handleKeyDownInInline)
|
this.el!.removeEventListener('keydown', this.handleKeyDownInInline)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue