From c02f88072db0220927ff012cc9fa4ab503e4d416 Mon Sep 17 00:00:00 2001 From: Alessandro Pagiaro Date: Wed, 22 May 2024 15:23:12 +0200 Subject: [PATCH 1/3] Memoize onCloseClick callback --- src/PopupWrapper/index.tsx | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/PopupWrapper/index.tsx b/src/PopupWrapper/index.tsx index 5c3ac66..c829e10 100644 --- a/src/PopupWrapper/index.tsx +++ b/src/PopupWrapper/index.tsx @@ -12,6 +12,18 @@ const useRerender = () => { return React.useCallback(() => rerender({}), []) } +function Popup({ show, onClose, currentPopup, ...props}){ + const onCloseClick = React.useCallback((params: any) => { + return onClose(currentPopup, params) + }, [onClose, currentPopup]) + + return +} + export function PopupsWrapper({popupManager}: PopupsWrapperProps){ const rerender = useRerender(); @@ -31,11 +43,12 @@ export function PopupsWrapper({popupManager}: PopupsWrapperProps){ return <> { popupManager.popups.map((currentPopup: PopupItem) => ( - onClose(currentPopup, params)} + currentPopup={currentPopup} + onClose={onClose} /> )) } From f5c0d407fc1e70165efc520913b4bc531032211c Mon Sep 17 00:00:00 2001 From: Alessandro Pagiaro Date: Wed, 22 May 2024 15:36:34 +0200 Subject: [PATCH 2/3] bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b2dd2fb..4c4e357 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@domotz/react-popup-manager", - "version": "3.2.3", + "version": "3.2.4", "description": "Manage react popups, Modals, Lightboxes, Notifications, etc. easily", "license": "MIT", "main": "dist/index.js", From 3e1713659b8433214b5dcc9fb950bfa5177d8d97 Mon Sep 17 00:00:00 2001 From: Alessandro Pagiaro Date: Wed, 22 May 2024 15:45:58 +0200 Subject: [PATCH 3/3] Bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4c4e357..af1b837 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@domotz/react-popup-manager", - "version": "3.2.4", + "version": "3.2.5", "description": "Manage react popups, Modals, Lightboxes, Notifications, etc. easily", "license": "MIT", "main": "dist/index.js",