From 531b521d44a9fc68811587d8d04190ab7b35e5c2 Mon Sep 17 00:00:00 2001 From: mdsiddiq-till <67993590+mdsiddiq-till@users.noreply.github.com> Date: Wed, 14 Feb 2024 09:54:57 +0530 Subject: [PATCH] fix: modal options across open modal calls (#60) * fix: update the modal props on every showModal call * chore: bump version --- package.json | 2 +- src/Modal.tsx | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index a765c7c..cae8b64 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "modal", "useModal" ], - "version": "0.2.1", + "version": "0.2.2", "main": "lib/index", "types": "lib", "files": [ diff --git a/src/Modal.tsx b/src/Modal.tsx index 2b8f9f5..5e896e8 100644 --- a/src/Modal.tsx +++ b/src/Modal.tsx @@ -38,7 +38,7 @@ export const ModalProvider: React.FC = ({ const showModal = useCallback( (content: React.ReactNode, options?: Partial) => { setContent(content); - if (options) optionsRef.current = options; + optionsRef.current = options; }, [], ); @@ -47,10 +47,10 @@ export const ModalProvider: React.FC = ({ setContent(null); }, []); - const value = useMemo(() => ({ showModal, closeModal }), [ - showModal, - closeModal, - ]); + const value = useMemo( + () => ({ showModal, closeModal }), + [showModal, closeModal], + ); return (