diff --git a/superset-frontend/src/SqlLab/App.jsx b/superset-frontend/src/SqlLab/App.jsx index 82132b79be..857d1db408 100644 --- a/superset-frontend/src/SqlLab/App.jsx +++ b/superset-frontend/src/SqlLab/App.jsx @@ -71,6 +71,12 @@ const sqlLabPersistStateConfig = { } }); + if (subset.sqlLab?.user) { + // Don't persist the user. + // User should really not be stored under the "sqlLab" field. Oh well. + delete subset.sqlLab.user; + } + const data = JSON.stringify(subset); // 2 digit precision const currentSize = @@ -81,6 +87,16 @@ const sqlLabPersistStateConfig = { return subset; }, + merge: (initialState, persistedState = {}) => { + const result = { + ...initialState, + ...persistedState, + }; + // Filter out any user data that may have been persisted in an older version. + // Get user from bootstrap data instead, every time + result.sqlLab.user = initialState.sqlLab.user; + return result; + }, }, };