From e6326c30bcb7c9d76c21076093603a36b3e253a9 Mon Sep 17 00:00:00 2001 From: Valery Zinchenko Date: Tue, 28 May 2024 18:35:20 +0300 Subject: [PATCH 1/4] fix modal window closing --- src/ModalController.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/ModalController.ts b/src/ModalController.ts index 257d49d..4fe7382 100644 --- a/src/ModalController.ts +++ b/src/ModalController.ts @@ -98,7 +98,7 @@ class ModalController = ModalContr const modalWindow = new ModalWindow(component, { ...this.config?.defaultParams, ...modalParams as MODAL_WINDOW_PARAMS_EXPLANATION

}) // Using `on` instead of `then` since `then` will only be executed on the next event loop iteration. // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Event_loop. - modalWindow.on("close", () => this.close(modalWindow)) + modalWindow.on("close", () => this.remove(modalWindow)) // Skip adding to queue if the window is already the last modal. @@ -155,6 +155,12 @@ class ModalController = ModalContr * Closes modal by its instance. */ public close(modalWindow: ModalWindowAny): void { + if (!this.windows.has(modalWindow)) return + + modalWindow.close() + } + + private remove(modalWindow: ModalWindowAny): void { if (this.windows.size === 0) return if (!this.windows.has(modalWindow)) return From e3faec6cdbcb061dd450d917b1becfacc916dc5e Mon Sep 17 00:00:00 2001 From: Valery Zinchenko Date: Tue, 28 May 2024 18:48:39 +0300 Subject: [PATCH 2/4] 2.3.5 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5a6e0f4..8aa60fc 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "type": "module", "name": "react-modal-global", - "version": "2.3.4", + "version": "2.3.5", "description": "Uncontrollable Global React Modal", "main": "dist/index.ts", "types": "dist/index.d.ts", From d0622b630126c6047729762067301491d5579d01 Mon Sep 17 00:00:00 2001 From: Valery Zinchenko Date: Tue, 28 May 2024 18:51:45 +0300 Subject: [PATCH 3/4] fix `main` --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8aa60fc..b97cc07 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "name": "react-modal-global", "version": "2.3.5", "description": "Uncontrollable Global React Modal", - "main": "dist/index.ts", + "main": "dist/index.js", "types": "dist/index.d.ts", "files": [ "dist", From a08a601d922ce824259f6feea898196b734ee09f Mon Sep 17 00:00:00 2001 From: Valery Zinchenko Date: Tue, 28 May 2024 18:51:47 +0300 Subject: [PATCH 4/4] 2.3.6 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b97cc07..0fd8c05 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "type": "module", "name": "react-modal-global", - "version": "2.3.5", + "version": "2.3.6", "description": "Uncontrollable Global React Modal", "main": "dist/index.js", "types": "dist/index.d.ts",