Skip to content

Commit

Permalink
Formio modal bug fix (#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 b59fdda commit cf4d511
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 cf4d511

Please sign in to comment.