improve sync
This commit is contained in:
parent
7afe2c58b0
commit
d50a74327f
2 changed files with 11 additions and 5 deletions
|
@ -632,9 +632,8 @@ export function doGetAndPopulatePreferences() {
|
|||
export function doHandleSyncComplete(error, hasNewData) {
|
||||
return (dispatch) => {
|
||||
if (!error) {
|
||||
dispatch(doGetAndPopulatePreferences());
|
||||
|
||||
if (hasNewData) {
|
||||
dispatch(doGetAndPopulatePreferences());
|
||||
// we just got sync data, better update our channels
|
||||
dispatch(doFetchChannelListMine());
|
||||
}
|
||||
|
|
|
@ -4,7 +4,12 @@ import * as SETTINGS from 'constants/settings';
|
|||
import { Lbryio } from 'lbryinc';
|
||||
import Lbry from 'lbry';
|
||||
import { doWalletEncrypt, doWalletDecrypt } from 'redux/actions/wallet';
|
||||
import { selectGetSyncIsPending, selectSetSyncIsPending, selectSyncIsLocked } from 'redux/selectors/sync';
|
||||
import {
|
||||
selectSyncHash,
|
||||
selectGetSyncIsPending,
|
||||
selectSetSyncIsPending,
|
||||
selectSyncIsLocked,
|
||||
} from 'redux/selectors/sync';
|
||||
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
||||
import { getSavedPassword } from 'util/saved-passwords';
|
||||
import { doAnalyticsTagSync, doHandleSyncComplete } from 'redux/actions/app';
|
||||
|
@ -154,7 +159,9 @@ export function doGetSync(passedPassword?: string, callback?: (any, ?boolean) =>
|
|||
}
|
||||
}
|
||||
|
||||
return (dispatch: Dispatch) => {
|
||||
return (dispatch: Dispatch, getState: GetState) => {
|
||||
const state = getState();
|
||||
const localHash = selectSyncHash(state);
|
||||
dispatch({
|
||||
type: ACTIONS.GET_SYNC_STARTED,
|
||||
});
|
||||
|
@ -182,7 +189,7 @@ export function doGetSync(passedPassword?: string, callback?: (any, ?boolean) =>
|
|||
const syncHash = response.hash;
|
||||
data.syncHash = syncHash;
|
||||
data.syncData = response.data;
|
||||
data.changed = response.changed;
|
||||
data.changed = response.changed || syncHash !== localHash;
|
||||
data.hasSyncedWallet = true;
|
||||
|
||||
if (response.changed) {
|
||||
|
|
Loading…
Reference in a new issue