fix: notification render error & remove SWR auto load on focus

This commit is contained in:
haitao(lj) 2022-09-28 15:06:56 +08:00
parent 2031b76ee5
commit a95ef9a477
2 changed files with 16 additions and 7 deletions

View File

@ -3,6 +3,8 @@ import { useTranslation } from 'react-i18next';
import { Outlet } from 'react-router-dom';
import { Helmet } from 'react-helmet';
import { SWRConfig } from 'swr';
import {
userInfoStore,
siteInfoStore,
@ -51,6 +53,10 @@ const Layout: FC = () => {
<meta name="description" content={siteInfo.description} />
) : null}
</Helmet>
<SWRConfig
value={{
revalidateOnFocus: false,
}}>
<Header />
<AdminHeader />
<div className="position-relative page-wrap">
@ -58,6 +64,7 @@ const Layout: FC = () => {
</div>
<Toast msg={toastMsg} variant={variant} onClose={closeToast} />
<Footer />
</SWRConfig>
</>
);
};

View File

@ -46,6 +46,8 @@ const Notifications = () => {
const handleTypeChange = (evt, val) => {
evt.preventDefault();
setPage(1);
setNotificationData([]);
navigate(`/users/notifications/${val}`);
};