@@ -33,15 +33,14 @@ import TopBar from "@/app/components/TopBar";
3333import CheckToggle from "@/app/components/CheckToggle" ;
3434import Groups from "@/app/components/Groups" ;
3535
36- let lastUpdate : string = "" ;
37-
3836export 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 < string > ( "" ) ;
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 ) ,
@@ -183,7 +182,7 @@ export function InstrumentData({ instrumentName }: { instrumentName: string }) {
183182 }
184183 }
185184 }
186- } , [ lastJsonMessage , currentInstrument , sendJsonMessage ] ) ;
185+ } , [ lastJsonMessage , currentInstrument , sendJsonMessage , lastUpdate ] ) ;
187186
188187 if ( ! instName || ! currentInstrument ) {
189188 return < h1 > Loading...</ h1 > ;
0 commit comments