File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -174,8 +174,15 @@ function ControlPanel(props: ControlPanelProps): React.ReactElement {
174174
175175 // Load UP42 data on component mount
176176 React . useEffect ( ( ) => {
177- if ( dataCollection . length > 0 ) return ;
178177 ( async ( ) => {
178+ const lastFetched = localStorage . getItem ( 'dataCollectionLastEdited' ) ;
179+ const today = new Date ( ) . toDateString ( ) ;
180+
181+ if ( lastFetched === today && dataCollection . length > 0 ) {
182+ console . log ( 'UP42 data already fresh for today, skipping fetch' ) ;
183+ return ;
184+ }
185+
179186 const { up42Email, up42Password } = apiKeys [ Providers . UP42 ] ;
180187 setIsUp42Loading ( true ) ;
181188 try {
@@ -189,6 +196,8 @@ function ControlPanel(props: ControlPanelProps): React.ReactElement {
189196 }
190197 return data ;
191198 } ) ;
199+
200+ localStorage . setItem ( 'dataCollectionLastEdited' , today ) ;
192201 } catch ( error ) {
193202 console . error ( 'UP42 CORS Error:' , error ) ;
194203 } finally {
You can’t perform that action at this time.
0 commit comments