@@ -58,7 +58,8 @@ class OpenInverterApp {
5858 renderParameters ( ) {
5959 // Load parameters if not already loaded
6060 if ( ! this . state . oiParameters && ! this . state . isLoadingOiParameters && this . state . isConnected ) {
61- this . refreshParameters ( )
61+ // Use setTimeout to avoid blocking render
62+ setTimeout ( ( ) => this . refreshParameters ( ) , 0 )
6263 }
6364
6465 return html `
@@ -227,6 +228,11 @@ class OpenInverterApp {
227228 }
228229
229230 async refreshParameters ( ) {
231+ if ( this . state . isLoadingOiParameters ) {
232+ console . log ( '[OI App] Already loading parameters, skipping' )
233+ return
234+ }
235+
230236 this . state . isLoadingOiParameters = true
231237 this . emit ( 'render' )
232238
@@ -259,7 +265,8 @@ class OpenInverterApp {
259265 */
260266 renderSpotvalues ( ) {
261267 if ( ! this . state . oiSpotValues && ! this . state . isLoadingOiSpotValues && this . state . isConnected ) {
262- this . refreshSpotValues ( )
268+ // Use setTimeout to avoid blocking render
269+ setTimeout ( ( ) => this . refreshSpotValues ( ) , 0 )
263270 }
264271
265272 return html `
@@ -342,6 +349,11 @@ class OpenInverterApp {
342349 }
343350
344351 async refreshSpotValues ( ) {
352+ if ( this . state . isLoadingOiSpotValues ) {
353+ console . log ( '[OI App] Already loading spot values, skipping' )
354+ return
355+ }
356+
345357 this . state . isLoadingOiSpotValues = true
346358 this . emit ( 'render' )
347359
0 commit comments