suddjian commented on a change in pull request #18773:
URL: https://github.com/apache/superset/pull/18773#discussion_r809467218
##########
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:
It's a pretty cheap endpoint to call, and most people probably aren't
changing tabs often enough to be an issue. I think this is fine.
--
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]