ad-m commented on a change in pull request #18773:
URL: https://github.com/apache/superset/pull/18773#discussion_r808617713



##########
File path: superset-frontend/src/preamble.ts
##########
@@ -67,3 +72,24 @@ export const theme = merge(
   supersetTheme,
   bootstrapData?.common?.theme_overrides ?? {},
 );
+
+const getMe = makeApi<void, User>({
+  method: 'GET',
+  endpoint: '/api/v1/me/',
+});
+
+/**
+ * When you re-open the window, we check if you are still logged in.
+ * If your session expired or you signed out, we'll redirect to login.
+ * If you aren't logged in in the first place (!isActive), then we shouldn't 
do this.
+ */
+if (bootstrapData.user?.isActive) {
+  document.addEventListener('visibilitychange', () => {
+    // we only care about the tab becoming visible, not vice versa
+    if (document.visibilityState !== 'visible') return;

Review comment:
       Do we want to do this every time the user changes a tab (even if there 
are two Superset tabs), or maybe not more often than every x seconds?




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