Skip to content

Commit edf6194

Browse files
committed
Fix for cyclic fetching user data
1 parent 208c543 commit edf6194

10 files changed

Lines changed: 26 additions & 20 deletions

File tree

client/src/App.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import Landing from "./pages/Landing.jsx";
2424
import JoinRequest from "./pages/JoinRequest.jsx";
2525
import UserHome from "./pages/UserHome.jsx";
2626
import {LoginRedirect} from "./pages/LoginRedirect.jsx";
27-
import {LOCAL_STORAGE_LOCATION} from "./utils/Login.js";
27+
import {SESSION_STORAGE_LOCATION} from "./utils/Login.js";
2828
import {Impersonating} from "./components/Impersonating.jsx";
2929
import System from "./pages/System.jsx";
3030
import {InvitationForm} from "./pages/InvitationForm.jsx";
@@ -87,9 +87,9 @@ const App = () => {
8787
menuItems: ["allApps"]
8888
}));
8989
}
90-
let storedLocation = localStorage.getItem(LOCAL_STORAGE_LOCATION);
90+
let storedLocation = sessionStorage.getItem(SESSION_STORAGE_LOCATION);
9191
if (!isEmpty(storedLocation)) {
92-
// Do not remove the LOCAL_STORAGE_LOCATION because in development mode this is called twice
92+
// Do not remove the SESSION_STORAGE_LOCATION because in development mode this is called twice
9393
if (!storedLocation.startsWith("/accept") && !hasOrganizationMemberships) {
9494
storedLocation = "/landing";
9595
}
@@ -111,7 +111,7 @@ const App = () => {
111111
navigate("/home");
112112
});
113113
})
114-
}, [impersonator, navigate]);
114+
}, [impersonator]); // eslint-disable-line react-hooks/exhaustive-deps
115115

116116
if (loading) {
117117
return <Loader/>

client/src/organization/UserManagement.jsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,12 @@ export const UserManagement = () => {
5151
setCurrentTab(name);
5252
useAppStore.setState({
5353
breadcrumbPaths: [
54-
{path: "/home", value: I18n.t("breadCrumb.access"),menuItemName: "yourApps"},
55-
{path: `/organization/${organizationId}`, value: res ? res.name : organization.name, menuItemName: "yourApps"},
54+
{path: "/home", value: I18n.t("breadCrumb.access"), menuItemName: "yourApps"},
55+
{
56+
path: `/organization/${organizationId}`,
57+
value: res ? res.name : organization.name,
58+
menuItemName: "yourApps"
59+
},
5660
{value: I18n.t(`breadCrumb.${name}`)}
5761
]
5862
});

client/src/pages/ApplicationDetail.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const ApplicationDetail = () => {
2626
setServiceProvider(res);
2727
setLoading(false);
2828
})
29-
.catch(e => {
29+
.catch(() => {
3030
navigate("/404");
3131
});
3232
}, []);// eslint-disable-line react-hooks/exhaustive-deps

client/src/pages/Applications.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ const Applications = () => {
8787
setSourceOptions(newSourceOptions);
8888
setLoading(false);
8989
})
90-
.catch(e => {
90+
.catch(() => {
9191
navigate("/404");
9292
});
9393
}, []);// eslint-disable-line react-hooks/exhaustive-deps

client/src/pages/Invitation.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {getParameterByName} from "../utils/QueryParameters.js";
77
import {Loader} from "@surfnet/sds";
88
import ConfirmationDialog from "../components/ConfirmationDialog.jsx";
99
import Welcome from "../icons/undraw/welcome.svg";
10-
import {LOCAL_STORAGE_LOCATION} from "../utils/Login.js";
10+
import {SESSION_STORAGE_LOCATION} from "../utils/Login.js";
1111

1212
export const Invitation = () => {
1313

@@ -21,7 +21,7 @@ export const Invitation = () => {
2121
getInvitationByHash(hash)
2222
.then(res => {
2323
setInvitation(res);
24-
localStorage.removeItem(LOCAL_STORAGE_LOCATION);
24+
sessionStorage.removeItem(SESSION_STORAGE_LOCATION);
2525
useAppStore.setState({
2626
breadcrumbPaths: [
2727
{path: "/home", value: I18n.t("breadCrumb.access"), menuItemName: "yourApps"},
@@ -31,7 +31,7 @@ export const Invitation = () => {
3131
});
3232
setLoading(false);
3333
})
34-
.catch(e => {
34+
.catch(() => {
3535
navigate("/404")
3636
});
3737
}, []);// eslint-disable-line react-hooks/exhaustive-deps

client/src/pages/LoginRedirect.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {useEffect} from "react";
22
import {Loader} from "@surfnet/sds";
33
import {useAppStore} from "../stores/AppStore.js";
4-
import {LOCAL_STORAGE_LOCATION, login} from "../utils/Login.js";
4+
import {SESSION_STORAGE_LOCATION, login} from "../utils/Login.js";
55
import {useLocation} from "react-router";
66

77
export const LoginRedirect = () => {
@@ -11,7 +11,7 @@ export const LoginRedirect = () => {
1111

1212
useEffect(() => {
1313
const locationUrl = currentLocation.pathname + currentLocation.search;
14-
localStorage.setItem(LOCAL_STORAGE_LOCATION, locationUrl);
14+
sessionStorage.setItem(SESSION_STORAGE_LOCATION, locationUrl);
1515
login(config);
1616
}, []);
1717

client/src/pages/NotFound.jsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ import React from "react";
33
import NotFoundLogo from "../icons/undraw_page_not_found_re_e9o6.svg";
44
import I18n from "../locale/I18n";
55

6-
const NotFound = () => (
7-
<div className={"not-found"}>
8-
<NotFoundLogo/>
9-
</div>
10-
);
6+
const NotFound = () => {
7+
return (
8+
<div className={"not-found"}>
9+
<NotFoundLogo/>
10+
</div>
11+
);
12+
}
1113
export default NotFound;

client/src/utils/Login.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {isEmpty, sanitizeURL} from "./Utils.js";
22

3-
export const LOCAL_STORAGE_LOCATION = "local_storage_location";
3+
export const SESSION_STORAGE_LOCATION = "session_storage_location";
44

55
export const login = (config, force = true, useEduID = false) => {
66
let params = force ? "?force=true" : "";

server/src/main/java/access/model/ApplicationMembership.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public class ApplicationMembership implements NameHolder {
3131

3232
@ManyToOne(fetch = FetchType.LAZY)
3333
@JoinColumn(name = "organization_membership_id")
34+
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
3435
private OrganizationMembership organizationMembership;
3536

3637
@Enumerated(EnumType.STRING)

server/src/test/java/access/api/ConnectionControllerTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import io.restassured.http.ContentType;
99
import lombok.SneakyThrows;
1010
import org.apache.commons.io.IOUtils;
11-
import org.junit.Ignore;
1211
import org.junit.jupiter.api.Disabled;
1312
import org.junit.jupiter.api.Test;
1413
import org.springframework.core.io.ClassPathResource;

0 commit comments

Comments
 (0)