From 6f88e0c1d9d3787a70a1b430d73d92ea70c4f31f Mon Sep 17 00:00:00 2001 From: Deepak Jose Date: Fri, 4 Oct 2024 10:35:19 +0530 Subject: [PATCH] Fixes issues due to transition delay in closing alerts. (#2321) * Created memoized children component that updates the children only when the should update prop is set to true. * Wrapped the modal children in the memoized component and set the shouldUpdate to isOpen or forceRender prop. * Added the new prop to the props list and the types file. * Updated button to be disabled only when the submission was going on. * Removed the test to verify the submit button calls are prevented during closing transition since it was a false test case. * Update types/Modal.d.ts Co-authored-by: Abhay V Ashokan <35297280+AbhayVAshokan@users.noreply.github.com> --------- Co-authored-by: Abhay V Ashokan <35297280+AbhayVAshokan@users.noreply.github.com> --- src/components/Alert.jsx | 2 +- src/components/Modal/MemoizedChildren.js | 10 ++++++++ src/components/Modal/index.jsx | 15 +++++++++--- tests/Alert.test.jsx | 31 ++++++------------------ types/Modal.d.ts | 2 +- 5 files changed, 31 insertions(+), 29 deletions(-) create mode 100644 src/components/Modal/MemoizedChildren.js diff --git a/src/components/Alert.jsx b/src/components/Alert.jsx index 1a1d3d70d..3f2e3afb5 100644 --- a/src/components/Alert.jsx +++ b/src/components/Alert.jsx @@ -77,7 +77,7 @@ const Alert = ({ )}