NewtonFernandis commented on code in PR #35143:
URL: https://github.com/apache/superset/pull/35143#discussion_r2349792048


##########
superset-embedded-sdk/src/index.ts:
##########
@@ -107,6 +107,9 @@ export async function embedDashboard({
   iframeSandboxExtras = [],
   referrerPolicy,
 }: EmbedDashboardParams): Promise<EmbeddedDashboard> {
+  let refreshTimerId: NodeJS.Timeout | null = null;
+  let isUnmounted = false;

Review Comment:
   Thanks for the question! You're right to question this, The problem is that 
setTimeout creates global browser timers that run independently of Angular's 
component lifecycle. Currently, refreshGuestToken creates a recursive chain of 
timers:
   setTimeout(refreshGuestToken, timing);
   // Inside refreshGuestToken, it schedules another:
   setTimeout(refreshGuestToken, timing);
   // This continues indefinitely...
   When the Angular component is destroyed and unmount() is called, these 
global timers keep running in the background. You can verify this by navigating 
away from the component and checking the browser's network tab you'll see 
fetchGuestToken requests continuing.
   



-- 
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