Skip to content

Commit 698cf66

Browse files
committed
Fixes #181
1 parent 3ebcfb7 commit 698cf66

36 files changed

+198
-64
lines changed

client/src/App.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const App = () => {
4545

4646
const [loading, setLoading] = useState(true);
4747
const [isAuthenticated, setIsAuthenticated] = useState(false);
48-
const {impersonator} = useAppStore(state => state);
48+
const impersonator= useAppStore(state => state.impersonator);
4949
const navigate = useNavigate();
5050
const currentLocation = useLocation();
5151

client/src/api/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,10 @@ export function updateOrganizationName(organizationId, newName) {
138138
return postPutJson("/api/v1/organizations", {id: organizationId, name: newName}, "PUT");
139139
}
140140

141+
export function updateOrganizationMetaData(organizationId, metaData) {
142+
return postPutJson(`/api/v1/organizations/metadata/${organizationId}`, metaData, "PUT");
143+
}
144+
141145
//JoinRequest
142146
export function newJoinRequest(joinRequest) {
143147
return postPutJson("/api/v1/join/", joinRequest, "POST");

client/src/application/AppTeamManagement.jsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,18 @@ import {useAppStore} from "../stores/AppStore.js";
1313
import MenuIcon from "../icons/menu.svg";
1414
import TrashIcon from "@surfnet/sds/icons/functional-icons/bin.svg";
1515
import SelectField from "../components/SelectField.jsx";
16+
import {useShallow} from "zustand/react/shallow";
1617

1718
export const AppTeamManagement = ({
1819
application,
1920
refresh
2021
}) => {
2122

22-
const {user: currentUser, setFlash} = useAppStore(state => state);
23+
const {user: currentUser, setFlash} = useAppStore(useShallow(state => ({
24+
user: state.user,
25+
setFlash: state.setFlash
26+
})));
27+
2328
const navigate = useNavigate();
2429

2530
const [confirmation, setConfirmation] = useState({});

client/src/components/BreadCrumb.jsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,15 @@ import {isEmpty, stopEvent} from "../utils/Utils";
55
import DOMPurify from "dompurify";
66
import ArrowRight from "../icons/arrow-right.svg";
77
import {useNavigate} from "react-router";
8+
import {useShallow} from "zustand/react/shallow";
89

910
export const BreadCrumb = () => {
1011

11-
const {breadcrumbPaths, clearFlash} = useAppStore(state => state);
12+
const {breadcrumbPaths, clearFlash} = useAppStore(useShallow(state => ({
13+
breadcrumbPaths: state.breadcrumbPaths,
14+
clearFlash: state.clearFlash
15+
})));
16+
1217
const navigate = useNavigate();
1318

1419

client/src/components/Impersonating.jsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,17 @@ import "./Impersonating.scss";
77
import ImpersonateIcon from "@surfnet/sds/icons/illustrative-icons/presentation-amphitheater.svg";
88
import DOMPurify from "dompurify";
99
import {useAppStore} from "../stores/AppStore";
10+
import {useShallow} from "zustand/react/shallow";
1011

1112
export const Impersonating = () => {
1213

13-
const {user: currentUser, setFlash, impersonator, stopImpersonation} = useAppStore(state => state);
14+
const {user: currentUser, setFlash, impersonator, stopImpersonation} = useAppStore(useShallow(state => ({
15+
user: state.user,
16+
setFlash: state.setFlash,
17+
impersonator: state.impersonator,
18+
stopImpersonation: state.stopImpersonation
19+
})));
20+
1421
const navigate = useNavigate();
1522

1623
const endImpersonation = () => {

client/src/components/SharedMenu.jsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,16 @@ import {SharedMenuFooter} from "./SharedMenuFooter.jsx";
1010
import {ORGANIZATION_STATUSES} from "../utils/Manage.js";
1111
import {allMenuGroups} from "../utils/MenuItems.js";
1212
import {isEmpty} from "../utils/Utils.js";
13+
import {useShallow} from "zustand/react/shallow";
1314

1415
export const SharedMenu = () => {
1516

16-
const {menuItems, currentOrganization, activeMenuItem} = useAppStore(state => state);
17+
const {menuItems, currentOrganization, activeMenuItem} = useAppStore(useShallow(state => ({
18+
menuItems: state.menuItems,
19+
currentOrganization: state.currentOrganization,
20+
activeMenuItem: state.activeMenuItem
21+
})));
22+
1723
const navigate = useNavigate();
1824

1925
const filteredMenuGroups = useMemo(() => {

client/src/connection/AppInformation.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export const AppInformation = ({
4141
arpInfo
4242
}) => {
4343

44-
const {setFlash} = useAppStore(state => state);
44+
const setFlash = useAppStore(state => state.setFlash);
4545

4646
const [section, setSection] = useState(sections.logo);
4747
const [initial, setInitial] = useState(true);

client/src/connection/ChangeRequests.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export const ChangeRequests = ({
2121
refresh,
2222
arpInfo
2323
}) => {
24-
const {setFlash} = useAppStore(state => state);
24+
const setFlash = useAppStore(state => state.setFlash);
2525

2626
const [isJsonDiffOpen, setIsJsonDiffOpen] = useState({});
2727

client/src/connection/Contract.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export const Contract = ({
2424
arpInfo
2525
}) => {
2626

27-
const {setFlash} = useAppStore(state => state);
27+
const setFlash = useAppStore(state => state.setFlash);
2828
const [loading, setLoading] = useState(false);
2929

3030
const submit = () => {

client/src/connection/Testing.jsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ import {useNavigate} from "react-router-dom";
6363
import {ConnectionAlert} from "./ConnectionAlert.jsx";
6464
import {createAndClickLink} from "../utils/Forms.js";
6565
import {ChangeRequests} from "./ChangeRequests.jsx";
66+
import {useShallow} from "zustand/react/shallow";
6667

6768
const sections = {
6869
pendingChanges: "pendingChanges",
@@ -109,7 +110,12 @@ export const Testing = ({
109110
setDirty,
110111
connectionId
111112
}) => {
112-
const {setFlash, config} = useAppStore(state => state);
113+
114+
const {config, setFlash} = useAppStore(useShallow(state => ({
115+
config: state.config,
116+
setFlash: state.setFlash
117+
})));
118+
113119
const navigate = useNavigate();
114120

115121
const [isCopyConnectionOpen, setIsCopyConnectionOpen] = useState(false);

0 commit comments

Comments
 (0)