Close modals on route change (#1613)

* Close modals on route change

* Release notes

* Fix import error
This commit is contained in:
Joel Jeremy Marquez
2023-08-31 07:55:43 -07:00
committed by GitHub
parent fc62d85c23
commit 05e582793d
2 changed files with 15 additions and 1 deletions

View File

@@ -1,5 +1,6 @@
import React from 'react';
import React, { useEffect } from 'react';
import { useSelector } from 'react-redux';
import { useLocation } from 'react-router-dom';
import { send } from 'loot-core/src/platform/client/fetch';
@@ -39,6 +40,13 @@ export default function Modals() {
state => state.prefs.local && state.prefs.local.id,
);
const actions = useActions();
const location = useLocation();
useEffect(() => {
if (modalStack.length > 0) {
actions.closeModal();
}
}, [location]);
const syncServerStatus = useSyncServerStatus();

View File

@@ -0,0 +1,6 @@
---
category: Bugfix
authors: [joel-jeremy]
---
Close open modals when navigating to a different URL.