Skip to content

Commit 70a37e4

Browse files
committed
fix: address Next.js build errors
1 parent 2e93d74 commit 70a37e4

File tree

4 files changed

+62
-49
lines changed

4 files changed

+62
-49
lines changed

package-lock.json

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/Panel.tsx

+29-20
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { useGlobusAuth } from "@globus/react-auth-context";
1111
import { flows } from "@globus/sdk";
1212
import { useEffect, useState } from "react";
1313
import { useFlowDefinitionDispatch } from "./FlowDefinitionProvider/FlowDefinitionProvider";
14+
import { FlowDefinition } from "@/pages";
1415

1516
export default function Panel() {
1617
const auth = useGlobusAuth();
@@ -34,7 +35,7 @@ export default function Panel() {
3435
const res = await (
3536
await flows.flows.getAll({
3637
headers: {
37-
Authorization: `Bearer ${token.access_token}`,
38+
Authorization: `Bearer ${token?.access_token}`,
3839
},
3940
})
4041
).json();
@@ -45,6 +46,8 @@ export default function Panel() {
4546
fetchFlows();
4647
}, [auth.authorization, auth.isAuthenticated]);
4748

49+
if (!flowDefinitionDispatch) return;
50+
4851
return (
4952
<Box h="100%" bg={"gray.100"} w={"280px"}>
5053
<Accordion defaultIndex={[0]} allowMultiple>
@@ -59,25 +62,31 @@ export default function Panel() {
5962
</AccordionButton>
6063
<AccordionPanel m={0} p={0}>
6164
<Box fontSize="sm">
62-
{userFlows.map((flow) => (
63-
<Box
64-
key={flow.id}
65-
onClick={() => {
66-
flowDefinitionDispatch({
67-
type: "replace",
68-
payload: flow.definition,
69-
});
70-
}}
71-
p={2}
72-
_hover={{
73-
bg: "gray.600",
74-
cursor: "pointer",
75-
color: "white",
76-
}}
77-
>
78-
{flow.title}
79-
</Box>
80-
))}
65+
{userFlows.map(
66+
(flow: {
67+
id: string;
68+
definition: FlowDefinition;
69+
title: string;
70+
}) => (
71+
<Box
72+
key={flow.id}
73+
onClick={() => {
74+
flowDefinitionDispatch({
75+
type: "replace",
76+
payload: flow.definition,
77+
});
78+
}}
79+
p={2}
80+
_hover={{
81+
bg: "gray.600",
82+
cursor: "pointer",
83+
color: "white",
84+
}}
85+
>
86+
{flow.title}
87+
</Box>
88+
),
89+
)}
8190
</Box>
8291
</AccordionPanel>
8392
</AccordionItem>

src/components/Validate.tsx

+26-24
Original file line numberDiff line numberDiff line change
@@ -81,32 +81,34 @@ export function ValidateButton() {
8181
* When Monaco is ready, and we have location errors, we'll add markers to the editor.
8282
*/
8383
if (monaco && locationErrors) {
84-
const markers = locationErrors.map((d) => {
85-
const [_definition, _state, stateName] = d.loc;
86-
const matches = model.findMatches(
87-
`"${stateName}":`,
88-
true,
89-
true,
90-
true,
91-
null,
92-
true,
93-
);
84+
const markers = locationErrors.map(
85+
(d: { loc: string[]; msg: string }) => {
86+
const [_definition, _state, stateName] = d.loc;
87+
const matches = model.findMatches(
88+
`"${stateName}":`,
89+
true,
90+
true,
91+
true,
92+
null,
93+
true,
94+
);
9495

95-
const location = matches[0]?.range ?? {
96-
startLineNumber: 1,
97-
endLineNumber: 1,
98-
startColumn: 1,
99-
endColumn: 1,
100-
};
96+
const location = matches[0]?.range ?? {
97+
startLineNumber: 1,
98+
endLineNumber: 1,
99+
startColumn: 1,
100+
endColumn: 1,
101+
};
101102

102-
return {
103-
...location,
104-
owner: GLOBUS_FLOWS_VALIDATION.OWNER,
105-
source: GLOBUS_FLOWS_VALIDATION.SOURCE,
106-
message: d.msg,
107-
severity: 8,
108-
};
109-
});
103+
return {
104+
...location,
105+
owner: GLOBUS_FLOWS_VALIDATION.OWNER,
106+
source: GLOBUS_FLOWS_VALIDATION.SOURCE,
107+
message: d.msg,
108+
severity: 8,
109+
};
110+
},
111+
);
110112

111113
monaco.editor.setModelMarkers(
112114
model,

src/pages/index.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,9 @@ export default function Home() {
103103
* @todo This will likely need to be removed/changed when the `<Panel>` with
104104
* user Flow selection is enabled.
105105
*/
106-
const storedDef = sessionStorage.getItem(STORED_DEFINITION_KEY);
106+
const storedDef =
107+
globalThis.sessionStorage &&
108+
globalThis.sessionStorage.getItem(STORED_DEFINITION_KEY);
107109

108110
const replaceDefinition = useCallback(
109111
(def: string | undefined) => {
@@ -123,7 +125,7 @@ export default function Home() {
123125
useEffect(() => {
124126
if (storedDef) {
125127
replaceDefinition(storedDef);
126-
sessionStorage.removeItem("definition");
128+
globalThis.sessionStorage.removeItem("definition");
127129
}
128130
}, [storedDef, replaceDefinition]);
129131

0 commit comments

Comments
 (0)