dosubot[bot] commented on issue #29902:
URL: https://github.com/apache/superset/issues/29902#issuecomment-2283446523

   <!-- Answer -->
   Yes, you can address the issue without making changes to the SDK package by 
implementing a mechanism in your application to detect when the internet 
connection is restored and then manually call the `fetchGuestToken` function.
   
   Here is an example of how you can achieve this using the `navigator.onLine` 
property and the `online` event listener in JavaScript:
   
   ```javascript
   function fetchGuestToken() {
     // Your implementation to fetch the guest token
   }
   
   function handleConnectionRestored() {
     if (navigator.onLine) {
       fetchGuestToken();
     }
   }
   
   // Add an event listener to detect when the internet connection is restored
   window.addEventListener('online', handleConnectionRestored);
   
   // Optionally, you can also check the connection status periodically
   setInterval(() => {
     if (navigator.onLine) {
       fetchGuestToken();
     }
   }, 60000); // Check every 60 seconds
   ```
   
   This approach ensures that the `fetchGuestToken` function is called whenever 
the internet connection is restored, thereby preventing guest token expiration 
and related errors 
<sup>[[1]](https://github.com/apache/superset/blob/master/superset-embedded-sdk/src/guestTokenRefresh.ts)</sup>.
   
   
   <!-- Dosu Comment Footer -->
   *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to