@@ -58,9 +58,11 @@ export function FloorDisplay({ floor, announcements: initialAnnouncements }: Pro
5858 // Fetch latest data without page reload
5959 const refreshData = useCallback ( async ( ) => {
6060 try {
61+ // Cache-bust with timestamp to ensure fresh data
62+ const cacheBust = Date . now ( ) ;
6163 const [ floorRes , annRes ] = await Promise . all ( [
62- fetch ( `/api/floors/${ floor . id } ` ) ,
63- fetch ( `/api/announcements?floorId=${ floor . id } &active=true` ) ,
64+ fetch ( `/api/floors/${ floor . id } ?t= ${ cacheBust } ` , { cache : "no-store" } ) ,
65+ fetch ( `/api/announcements?floorId=${ floor . id } &active=true&t= ${ cacheBust } ` , { cache : "no-store" } ) ,
6466 ] ) ;
6567 if ( floorRes . ok ) {
6668 const data = await floorRes . json ( ) ;
@@ -79,8 +81,9 @@ export function FloorDisplay({ floor, announcements: initialAnnouncements }: Pro
7981 ) ;
8082 }
8183 setLastUpdate ( Date . now ( ) ) ;
84+ console . log ( "[display] data refreshed successfully" ) ;
8285 } catch ( e ) {
83- console . warn ( "[display] refresh failed:" , e ) ;
86+ console . error ( "[display] refresh failed:" , e ) ;
8487 }
8588 } , [ floor . id ] ) ;
8689
@@ -137,15 +140,28 @@ export function FloorDisplay({ floor, announcements: initialAnnouncements }: Pro
137140
138141 // Aggressive fallback: refresh every 10s if no recent update
139142 useEffect ( ( ) => {
140- const timer = setInterval ( ( ) => {
143+ const checkTimer = setInterval ( ( ) => {
141144 const timeSinceLastUpdate = Date . now ( ) - lastUpdate ;
142145 // Refresh if >8 seconds since last successful update
143146 if ( timeSinceLastUpdate > 8_000 ) {
144147 console . log ( `[display] fallback refresh (${ Math . round ( timeSinceLastUpdate / 1000 ) } s since last update)` ) ;
145148 refreshData ( ) ;
146149 }
147150 } , 3_000 ) ; // Check every 3s (fast and lightweight)
148- return ( ) => clearInterval ( timer ) ;
151+
152+ // Nuclear option: if no update for 2 minutes, hard reload page
153+ const hardReloadTimer = setInterval ( ( ) => {
154+ const timeSinceLastUpdate = Date . now ( ) - lastUpdate ;
155+ if ( timeSinceLastUpdate > 120_000 ) {
156+ console . warn ( "[display] NO UPDATE FOR 2 MINUTES - HARD RELOAD PAGE" ) ;
157+ window . location . reload ( ) ;
158+ }
159+ } , 30_000 ) ;
160+
161+ return ( ) => {
162+ clearInterval ( checkTimer ) ;
163+ clearInterval ( hardReloadTimer ) ;
164+ } ;
149165 } , [ refreshData , lastUpdate ] ) ;
150166
151167 const now = time . getTime ( ) ;
0 commit comments