Skip to content

Commit 692cacf

Browse files
committed
Navigation bug fixes
1 parent 54958cf commit 692cacf

File tree

3 files changed

+9
-12
lines changed

3 files changed

+9
-12
lines changed

src/custom/subflow.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
import "./custom.css";
22
import { memo } from "react";
33
import { Button } from "react-bootstrap";
4-
import { useNavigate } from "react-router-dom";
4+
import { useNavigate, useLocation } from "react-router-dom";
55

66
import { Handle, Position, NodeResizer } from 'reactflow';
77

88

99
function SubFlowNode({ data, selected }: { data: any, selected: any }) {
1010
const navigate = useNavigate();
11+
const { state } = useLocation();
1112

1213

1314
const navigateToFlow = () => {
14-
navigate(window.location.pathname + '/' + data.slug);
15+
navigate(window.location.pathname + '/' + data.slug, { state });
1516
};
1617

1718
return (
@@ -31,7 +32,6 @@ function SubFlowNode({ data, selected }: { data: any, selected: any }) {
3132
</div>
3233
<div className="card-footer">
3334
<Button variant="secondary" size="sm" onClick={() => {
34-
console.log("Loading flow...");
3535
navigateToFlow();
3636
}}>
3737
{data.flow}

src/designer/designer.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ export default function Designer({ activeWorkspace, setActiveWorkspace, flow }:
174174
}`;
175175

176176
Client(query).then((data: any) => {
177+
data.getFlows.flows.sort((a: any, b: any) => slugs.indexOf(a.slug) - slugs.indexOf(b.slug));
177178
if (data.getFlows.flows[data.getFlows.flows.length - 1].id !== flow?.activeFlow?.id) {
178179
flow.setFlows(data.getFlows.flows)
179180
}
@@ -364,7 +365,7 @@ export default function Designer({ activeWorkspace, setActiveWorkspace, flow }:
364365
if (activeWorkspace.default?.position !== null) {
365366
setViewport(activeWorkspace.default.position);
366367
}
367-
368+
368369
flow.setActiveFlow(activeWorkspace.default);
369370
flow.setFlows([activeWorkspace.default]);
370371
loadFlowNodesAndEdges(activeWorkspace.default);
@@ -378,7 +379,7 @@ export default function Designer({ activeWorkspace, setActiveWorkspace, flow }:
378379
if (activeWorkspace.default?.position !== null) {
379380
setViewport(activeWorkspace.default.position);
380381
}
381-
382+
382383
flow.setActiveFlow(activeWorkspace.default);
383384
flow.setFlows([activeWorkspace.default]);
384385
loadFlowNodesAndEdges(activeWorkspace.default);

src/home/home.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,9 @@ export default function Home({setActiveWorkspace, flow}: {setActiveWorkspace: an
4747
}
4848
}`;
4949

50-
try {
51-
await Client(query).then((data: any) => {
52-
setWorkspaces(data.getWorkspaces.workspaces);
53-
})
54-
} catch (error) {
55-
console.error('Error fetching data:', error);
56-
}
50+
await Client(query).then((data: any) => {
51+
setWorkspaces(data.getWorkspaces.workspaces);
52+
})
5753
}, []);
5854

5955
useEffect(() => {

0 commit comments

Comments
 (0)