@@ -26,6 +26,7 @@ interface StatsState {
2626 monitorStatus : MonitorStatus ;
2727 currentApp : string ;
2828 loading : boolean ;
29+ hasLoaded : boolean ;
2930 selectedDate : string ;
3031 periodMode : PeriodMode ;
3132 weekComparison : AppUsageComparison [ ] ;
@@ -81,6 +82,7 @@ export const useStatsStore = create<StatsState>((set, get) => ({
8182 monitorStatus : { active : true , current_app : "" , current_exe_path : "" , current_title : "" } ,
8283 currentApp : "" ,
8384 loading : false ,
85+ hasLoaded : false ,
8486 selectedDate : todayStr ( ) ,
8587 periodMode : "day" ,
8688 weekComparison : [ ] ,
@@ -111,7 +113,7 @@ export const useStatsStore = create<StatsState>((set, get) => ({
111113 } catch ( e ) {
112114 console . error ( "fetchToday failed" , e ) ;
113115 } finally {
114- set ( { loading : false } ) ;
116+ set ( { loading : false , hasLoaded : true } ) ;
115117 }
116118 } ,
117119
@@ -144,7 +146,7 @@ export const useStatsStore = create<StatsState>((set, get) => ({
144146 console . error ( "fetchForDate failed" , e ) ;
145147 set ( { todayTotals : [ ] , todayHourly : [ ] , totalSecondsToday : 0 } ) ;
146148 } finally {
147- set ( { loading : false } ) ;
149+ set ( { loading : false , hasLoaded : true } ) ;
148150 }
149151 } ,
150152
@@ -169,7 +171,7 @@ export const useStatsStore = create<StatsState>((set, get) => ({
169171 } catch ( e ) {
170172 console . error ( "fetchForRange failed" , e ) ;
171173 } finally {
172- set ( { loading : false } ) ;
174+ set ( { loading : false , hasLoaded : true } ) ;
173175 }
174176 } ,
175177
0 commit comments