EnxDev commented on code in PR #36490:
URL: https://github.com/apache/superset/pull/36490#discussion_r2634371974


##########
superset-frontend/src/features/home/RightMenu.tsx:
##########
@@ -335,7 +342,18 @@ const RightMenu = ({
   const handleDatabaseAdd = () => setQuery({ databaseAdded: true });
 
   const handleLogout = () => {
-    localStorage.removeItem('redux');
+    try {
+      if (typeof window !== 'undefined') {
+        if (window.localStorage?.removeItem) {

Review Comment:
   ```suggestion
           if (window.localStorage.removeItem) {
   ```



##########
superset-frontend/src/features/home/RightMenu.tsx:
##########
@@ -335,7 +342,18 @@ const RightMenu = ({
   const handleDatabaseAdd = () => setQuery({ databaseAdded: true });
 
   const handleLogout = () => {
-    localStorage.removeItem('redux');
+    try {
+      if (typeof window !== 'undefined') {

Review Comment:
   Would it be necessary to keep this?



##########
superset-frontend/src/features/home/RightMenu.tsx:
##########
@@ -335,7 +342,18 @@ const RightMenu = ({
   const handleDatabaseAdd = () => setQuery({ databaseAdded: true });
 
   const handleLogout = () => {
-    localStorage.removeItem('redux');
+    try {
+      if (typeof window !== 'undefined') {
+        if (window.localStorage?.removeItem) {
+          window.localStorage.removeItem('redux');
+        }
+        if (window.sessionStorage?.removeItem) {
+          window.sessionStorage.removeItem('login_attempted');
+        }
+      }
+    } catch {
+      // Swallow storage errors to avoid crashing when storage is unavailable

Review Comment:
   How about adding a warning message there?



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