Skip to content

Commit 35e2ee2

Browse files
committed
use a setState for lastUpdate
1 parent 2d4c0f7 commit 35e2ee2

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

app/components/InstrumentData.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,14 @@ import TopBar from "@/app/components/TopBar";
3333
import CheckToggle from "@/app/components/CheckToggle";
3434
import Groups from "@/app/components/Groups";
3535

36-
let lastUpdate: string = "";
37-
3836
export function InstrumentData({ instrumentName }: { instrumentName: string }) {
3937
const [showHiddenBlocks, setShowHiddenBlocks] = useState(false);
4038
const CONFIG_DETAILS = "CS:BLOCKSERVER:WD_CONF_DETAILS";
4139
const [instlist, setInstlist] = useState<instList | null>(null);
4240
const [currentInstrument, setCurrentInstrument] = useState<Instrument | null>(
4341
null,
4442
);
43+
const [lastUpdate, setLastUpdate] = useState<str>("");
4544

4645
const instName = instrumentName;
4746

@@ -119,7 +118,7 @@ export function InstrumentData({ instrumentName }: { instrumentName: string }) {
119118
// config hasnt actually changed so do nothing
120119
return;
121120
}
122-
lastUpdate = updatedPVbytes;
121+
setLastUpdate(updatedPVbytes);
123122
const res = dehex_and_decompress(atob(updatedPVbytes));
124123
currentInstrument.groups = getGroupsWithBlocksFromConfigOutput(
125124
JSON.parse(res),

0 commit comments

Comments
 (0)