MM-14459 Ensure hydrationComplete is set to true when resetting the cache and logging out (#2664)

This commit is contained in:
Elias Nahum 2019-03-23 11:07:43 -03:00 committed by GitHub
parent fc5f33c03c
commit e960d37cdc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 3 deletions

View file

@ -91,7 +91,7 @@ const initializeModules = () => {
EventEmitter.on(NavigationTypes.RESTART_APP, restartApp);
EventEmitter.on(General.SERVER_VERSION_CHANGED, handleServerVersionChanged);
EventEmitter.on(General.CONFIG_CHANGED, handleConfigChanged);
EventEmitter.on(General.SWITCH_TO_DEFAULT_CHANNEL, handleSwithToDefaultChannel);
EventEmitter.on(General.SWITCH_TO_DEFAULT_CHANNEL, handleSwitchToDefaultChannel);
Dimensions.addEventListener('change', handleOrientationChange);
mattermostManaged.addEventListener('managedConfigDidChange', () => {
handleManagedConfig(true);
@ -338,7 +338,7 @@ const handleAuthentication = async (vendor) => {
return true;
};
const handleSwithToDefaultChannel = (teamId) => {
const handleSwitchToDefaultChannel = (teamId) => {
store.dispatch(selectDefaultChannel(teamId));
};

View file

@ -145,7 +145,6 @@ export default function configureAppStore(initialState) {
const persistor = persistStore(store, {storage: AsyncStorage, ...options}, () => {
store.dispatch({
type: General.STORE_REHYDRATION_COMPLETE,
complete: true,
});
});
@ -204,6 +203,9 @@ export default function configureAppStore(initialState) {
type: General.OFFLINE_STORE_RESET,
data: initialState,
},
{
type: General.STORE_REHYDRATION_COMPLETE,
},
{
type: ViewTypes.SERVER_URL_CHANGED,
serverUrl: state.entities.general.credentials.url || state.views.selectServer.serverUrl,
@ -256,6 +258,9 @@ export default function configureAppStore(initialState) {
type: GeneralTypes.RECEIVED_SERVER_VERSION,
data: state.entities.general.serverVersion,
},
{
type: General.STORE_REHYDRATION_COMPLETE,
},
], 'BATCH_FOR_RESTART'));
setTimeout(() => {

View file

@ -166,6 +166,9 @@ function resetStateForNewVersion(action) {
thread: {
drafts: threadDrafts,
},
root: {
hydrationComplete: true,
},
selectServer,
recentEmojis,
},