@@ -79,16 +79,20 @@ const syncDebounced = (dispatch, getState, options) => {
79
79
} ;
80
80
81
81
export const sync = ( options ) => ( dispatch , getState ) => {
82
- // If the user hits the 'sync' button, no matter if there's a sync
83
- // in progress or if the sync 'should' be debounced, listen to the
84
- // user and start a sync.
85
- if ( options . forceAction === 'manual' ) {
86
- console . log ( 'forcing sync' ) ;
87
- const files = getState ( ) . org . present . get ( 'files' ) ;
88
- // sync all files on manual sync
89
- files . keySeq ( ) . forEach ( ( path ) => dispatch ( doSync ( { ...options , path } ) ) ) ;
90
- } else {
91
- syncDebounced ( dispatch , getState , options ) ;
82
+ // Don't do anything if the browser is not online. When it gets back
83
+ // from an offline state, a new `sync`action will be triggered then.
84
+ if ( getState ( ) . base . get ( 'online' ) ) {
85
+ // If the user hits the 'sync' button, no matter if there's a sync
86
+ // in progress or if the sync 'should' be debounced, listen to the
87
+ // user and start a sync.
88
+ if ( options . forceAction === 'manual' ) {
89
+ console . log ( 'forcing sync' ) ;
90
+ const files = getState ( ) . org . present . get ( 'files' ) ;
91
+ // sync all files on manual sync
92
+ files . keySeq ( ) . forEach ( ( path ) => dispatch ( doSync ( { ...options , path } ) ) ) ;
93
+ } else {
94
+ syncDebounced ( dispatch , getState , options ) ;
95
+ }
92
96
}
93
97
} ;
94
98
0 commit comments