From 96eb041b99e277cf7c9da29012c8edfd562efacf Mon Sep 17 00:00:00 2001 From: Etienne Lemay Date: Sat, 6 Jan 2024 15:27:36 -0500 Subject: [PATCH] =?UTF-8?q?Move=20removeListener=20to=20unregister=20So=20?= =?UTF-8?q?that=20it=E2=80=99s=20properly=20called=20when=20the=20DOMNode?= =?UTF-8?q?=20is=20removed=20from=20the=20DOM?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/emoji-mart/src/components/Picker/Picker.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/emoji-mart/src/components/Picker/Picker.tsx b/packages/emoji-mart/src/components/Picker/Picker.tsx index 692b0fb9..e35717f3 100644 --- a/packages/emoji-mart/src/components/Picker/Picker.tsx +++ b/packages/emoji-mart/src/components/Picker/Picker.tsx @@ -106,7 +106,6 @@ export default class Picker extends Component { componentWillUnmount() { this.unregister() - this.darkMedia?.removeListener(this.darkMediaCallback) } async reset(nextState = {}) { @@ -128,6 +127,7 @@ export default class Picker extends Component { unregister() { document.removeEventListener('click', this.handleClickOutside) + this.darkMedia?.removeListener(this.darkMediaCallback) this.unobserve() }