diff --git a/src/components/Loading.test.tsx b/src/components/Loading.test.tsx index 80a1c02f9..7880133d7 100644 --- a/src/components/Loading.test.tsx +++ b/src/components/Loading.test.tsx @@ -16,9 +16,9 @@ describe('components/Loading.tsx', () => { jest.clearAllMocks(); }); - it('should check that NProgress is getting called in when isFetching changes (loading)', () => { + it('should check that NProgress is getting called in when status changes (loading)', () => { const { container } = render( - + , ); @@ -28,9 +28,9 @@ describe('components/Loading.tsx', () => { expect(NProgress.start).toHaveBeenCalledTimes(1); }); - it('should check that NProgress is getting called in when isFetching changes (not loading)', () => { + it('should check that NProgress is getting called in when status changes (not loading)', () => { const { container } = render( - + , ); @@ -42,7 +42,7 @@ describe('components/Loading.tsx', () => { it('should remove NProgress on unmount', () => { const { unmount } = render( - + , ); diff --git a/src/components/Loading.tsx b/src/components/Loading.tsx index 18c1dc152..ad1fc4c20 100644 --- a/src/components/Loading.tsx +++ b/src/components/Loading.tsx @@ -4,7 +4,7 @@ import { useContext, useEffect } from 'react'; import { AppContext } from '../context/App'; export const Loading = () => { - const { isFetching } = useContext(AppContext); + const { status } = useContext(AppContext); useEffect(() => { NProgress.configure({ @@ -17,12 +17,12 @@ export const Loading = () => { }, []); useEffect(() => { - if (isFetching) { + if (status === 'loading') { NProgress.start(); } else { NProgress.done(); } - }, [isFetching]); + }, [status]); return null; }; diff --git a/src/components/Sidebar.tsx b/src/components/Sidebar.tsx index 216e5b2a4..e47171b0e 100644 --- a/src/components/Sidebar.tsx +++ b/src/components/Sidebar.tsx @@ -19,7 +19,7 @@ export const Sidebar: FC = () => { const navigate = useNavigate(); const location = useLocation(); - const { notifications, fetchNotifications, isLoggedIn, isFetching } = + const { notifications, fetchNotifications, isLoggedIn, status } = useContext(AppContext); const onOpenBrowser = useCallback(() => { @@ -81,15 +81,14 @@ export const Sidebar: FC = () => { navigate('/', { replace: true }); fetchNotifications(); }} - disabled={isFetching} + disabled={status === 'loading'} > -