fix(sqllab): don't store user in localstorage (#14722)

* fix(sqllab): remove user info from localstorage

* filter out user data when loading localstorage
This commit is contained in:
David Aaron Suddjian 2021-05-20 16:35:56 -07:00 committed by GitHub
parent 32622c5081
commit 0e86a6b81c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 0 deletions

View File

@ -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;
},
},
};