@@ -405,6 +405,33 @@ export default function Widget (props: AllWidgetProps<IMConfig>) {
405405 setFeatureIndex ( ( prev ) => ( prev >= featureCount - 1 ? 0 : prev + 1 ) )
406406 } , [ featureCount ] )
407407
408+ // ── Display tick (re-renders "Last Updated" text every 5 s) ─────────
409+
410+ const [ , setTick ] = React . useState ( 0 )
411+ React . useEffect ( ( ) => {
412+ if ( ! isConfigured ) return
413+ const id = setInterval ( ( ) => { setTick ( ( v ) => v + 1 ) } , 5000 )
414+ return ( ) => { clearInterval ( id ) }
415+ } , [ isConfigured ] )
416+
417+ // ── Data refresh on configurable interval ────────────────────────────
418+
419+ const refreshMs = React . useMemo ( ( ) => {
420+ const val = config . refreshIntervalValue ?? 5
421+ const unit = config . refreshIntervalUnit ?? "minutes"
422+ const multiplier = unit === "hours" ? 3600000 : unit === "minutes" ? 60000 : 1000
423+ return Math . max ( val * multiplier , 1000 )
424+ } , [ config . refreshIntervalValue , config . refreshIntervalUnit ] )
425+
426+ React . useEffect ( ( ) => {
427+ if ( ! isConfigured ) return
428+ const id = setInterval ( ( ) => {
429+ setMainTrigger ( ( v ) => v + 1 )
430+ setRefTrigger ( ( v ) => v + 1 )
431+ } , refreshMs )
432+ return ( ) => { clearInterval ( id ) }
433+ } , [ isConfigured , refreshMs ] )
434+
408435 // ── Main query effect ──────────────────────────────────────────────────
409436
410437 React . useEffect ( ( ) => {
0 commit comments