[MM-19841] Keep currentTeamId and team theme preferences when resetting state (#3519) (#3525)

* Keep currentTeamId and team theme preferences

* Missing semicolon

* Update mattermost-redux commit
This commit is contained in:
Miguel Alatzar 2019-11-06 20:42:45 -07:00 committed by GitHub
parent d3f598a674
commit 82ac3fa1e9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 3376 additions and 5821 deletions

View file

@ -6,6 +6,7 @@ import {Platform} from 'react-native';
import AsyncStorage from '@react-native-community/async-storage';
import {createBlacklistFilter} from 'redux-persist-transform-filter';
import {createTransform, persistStore} from 'redux-persist';
import merge from 'deepmerge';
import {ErrorTypes, GeneralTypes} from 'mattermost-redux/action_types';
import {General, RequestStatus} from 'mattermost-redux/constants';
@ -241,10 +242,29 @@ export default function configureAppStore(initialState) {
await persistor.purge();
const {currentTeamId} = state.entities.teams;
const myPreferences = {...state.entities.preferences.myPreferences};
Object.keys(myPreferences).forEach((key) => {
if (!key.startsWith('theme--')) {
Reflect.deleteProperty(myPreferences, key);
}
});
const initialStateWithTeamAndThemePreferences = merge(initialState, {
entities: {
teams: {
currentTeamId,
},
preferences: {
myPreferences,
},
},
});
store.dispatch(batchActions([
{
type: General.OFFLINE_STORE_RESET,
data: initialState,
data: initialStateWithTeamAndThemePreferences,
},
{
type: ErrorTypes.RESTORE_ERRORS,

9173
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -21,7 +21,7 @@
"intl": "1.2.5",
"jail-monkey": "2.2.0",
"jsc-android": "241213.2.0",
"mattermost-redux": "github:mattermost/mattermost-redux#d5589eb991a809e7796fed490732b9f4773fcacd",
"mattermost-redux": "github:mattermost/mattermost-redux#46d8fadbbd1b1190430574bc2376453c6f5a8f92",
"mime-db": "1.40.0",
"moment-timezone": "0.5.25",
"prop-types": "15.7.2",