File tree Expand file tree Collapse file tree 3 files changed +12
-5
lines changed Expand file tree Collapse file tree 3 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -31,8 +31,6 @@ import {
31
31
shortenName ,
32
32
tabColor ,
33
33
} from "components/AppBar/AppBarTypes" ;
34
- import { clearCurrentProject } from "components/Project/ProjectActions" ;
35
- import { useAppDispatch } from "rootRedux/hooks" ;
36
34
import { Path } from "types/path" ;
37
35
import { RuntimeConfig } from "types/runtimeConfig" ;
38
36
import { openUserGuide } from "utilities/pathUtilities" ;
@@ -119,7 +117,6 @@ interface UserMenuListProps {
119
117
*/
120
118
export function UserMenuList ( props : UserMenuListProps ) : ReactElement {
121
119
const combineAppRelease = RuntimeConfig . getInstance ( ) . appRelease ( ) ;
122
- const dispatch = useAppDispatch ( ) ;
123
120
const { t } = useTranslation ( ) ;
124
121
const navigate = useNavigate ( ) ;
125
122
@@ -132,7 +129,6 @@ export function UserMenuList(props: UserMenuListProps): ReactElement {
132
129
< MenuItem
133
130
id = { `${ idAffix } -admin` }
134
131
onClick = { ( ) => {
135
- dispatch ( clearCurrentProject ( ) ) ;
136
132
navigate ( Path . SiteSettings ) ;
137
133
props . onSelect ( ) ;
138
134
} }
Original file line number Diff line number Diff line change @@ -4,13 +4,16 @@ import {
4
4
type ReactElement ,
5
5
type ReactNode ,
6
6
type SyntheticEvent ,
7
+ useEffect ,
7
8
useState ,
8
9
} from "react" ;
9
10
import { useTranslation } from "react-i18next" ;
10
11
12
+ import { clearCurrentProject } from "components/Project/ProjectActions" ;
11
13
import Banners from "components/SiteSettings/Banners" ;
12
14
import ProjectManagement from "components/SiteSettings/ProjectManagement" ;
13
15
import UserManagement from "components/SiteSettings/UserManagement" ;
16
+ import { useAppDispatch } from "rootRedux/hooks" ;
14
17
15
18
export const enum SiteSettingsTab {
16
19
Projects ,
@@ -19,10 +22,13 @@ export const enum SiteSettingsTab {
19
22
}
20
23
21
24
export default function SiteSettings ( ) : ReactElement {
25
+ const dispatch = useAppDispatch ( ) ;
22
26
const { t } = useTranslation ( ) ;
23
27
24
28
const [ tab , setTab ] = useState ( SiteSettingsTab . Projects ) ;
25
29
30
+ useEffect ( ( ) => dispatch ( clearCurrentProject ( ) ) , [ dispatch ] ) ;
31
+
26
32
const handleChange = ( _e : SyntheticEvent , val : SiteSettingsTab ) : void =>
27
33
setTab ( val ) ;
28
34
Original file line number Diff line number Diff line change @@ -13,7 +13,12 @@ jest.mock("backend", () => ({
13
13
getAllUsers : ( ...args : any [ ] ) => mockGetAllUsers ( ...args ) ,
14
14
getBannerText : ( ...args : any [ ] ) => mockGetBannerText ( ...args ) ,
15
15
} ) ) ;
16
- jest . mock ( "components/Project/ProjectActions" , ( ) => ( { } ) ) ;
16
+ jest . mock ( "components/Project/ProjectActions" , ( ) => ( {
17
+ clearCurrentProject : ( ) => jest . fn ( ) ,
18
+ } ) ) ;
19
+ jest . mock ( "rootRedux/hooks" , ( ) => ( {
20
+ useAppDispatch : ( ) => jest . fn ( ) ,
21
+ } ) ) ;
17
22
18
23
const setupMocks = ( ) : void => {
19
24
mockGetAllProjects . mockResolvedValue ( [ ] ) ;
You can’t perform that action at this time.
0 commit comments