Skip to content

Commit

Permalink
Formio modal bug fix (bcgov#2161)
Browse files Browse the repository at this point in the history
* Add formio modal checker

* update formioModalListener
  • Loading branch information
djnunez-aot authored Sep 13, 2023
1 parent ad5cefe commit 2b89a3d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
17 changes: 17 additions & 0 deletions met-web/src/components/FormioModalListener/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { useEffect } from 'react';
import { useLocation } from 'react-router-dom';

const FormioModalListener = () => {
const { pathname } = useLocation();

useEffect(() => {
const formioModal = document.querySelector('.formio-dialog');
if (formioModal) {
formioModal.remove();
}
}, [pathname]);

return null;
};

export default FormioModalListener;
2 changes: 2 additions & 0 deletions met-web/src/routes/AuthenticatedRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@ import { USER_ROLES } from 'services/userService/constants';
import UserProfile from 'components/userManagement/userDetails';
import ScrollToTop from 'components/scrollToTop';
import ReportSettings from 'components/survey/report';
import FormioModalListener from 'components/FormioModalListener';

const AuthenticatedRoutes = () => {
return (
<>
<ScrollToTop />
<FormioModalListener />
<Routes>
<Route path="/" element={<Dashboard />} />
<Route path="/engagements" element={<EngagementListing />} />
Expand Down

0 comments on commit 2b89a3d

Please sign in to comment.