Skip to content

Commit 4cc3b83

Browse files
committed
fix(relay-workflows-lib): fix live update bug
1 parent 0760e34 commit 4cc3b83

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

frontend/relay-workflows-lib/lib/components/WorkflowsContent.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useEffect, useRef, useState } from "react";
1+
import { useEffect, useRef, useState, useMemo } from "react";
22
import { PreloadedQuery, usePreloadedQuery } from "react-relay";
33
import { Box, Button, FormControlLabel, Switch, useTheme } from "@mui/material";
44
import { Visit } from "@diamondlightsource/sci-react-ui";
@@ -40,9 +40,10 @@ export default function WorkflowsContent({
4040
const theme = useTheme();
4141
const data = usePreloadedQuery(workflowsQuery, queryReference);
4242
const pageInfo = data.workflows.pageInfo;
43-
const fetchedWorkflows = data.workflows.nodes.map(
43+
const fetchedWorkflows = useMemo(() => {
44+
return data.workflows.nodes.map(
4445
(wf: { readonly name: string }) => wf.name,
45-
);
46+
)}, [data.workflows.nodes]);
4647
const prevFetchedRef = useRef<string[]>([]);
4748

4849
const [visibleWorkflows, setVisibleWorkflows] =

0 commit comments

Comments
 (0)