File tree Expand file tree Collapse file tree 2 files changed +14
-9
lines changed Expand file tree Collapse file tree 2 files changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import { appEventTypes, logEvent } from '/helpers/app'
3
3
import { loadKeybindings } from ' /src/store/modules/keybindings'
4
4
import { loadDocs } from ' /src/store/plugins/caching/documents'
5
5
import { loadSettings } from ' /src/store/plugins/caching/settings'
6
+ import { syncDocs } from ' /src/store/plugins/sync'
6
7
7
8
import ' overlayscrollbars/overlayscrollbars.css'
8
9
@@ -21,6 +22,8 @@ export default defineComponent({
21
22
await loadDocs (store )
22
23
await loadKeybindings (store )
23
24
25
+ syncDocs (store )
26
+
24
27
// This is used by tests to determine when the app is ready.
25
28
document .body .dataset .isMounted = ' true'
26
29
Original file line number Diff line number Diff line change 1
- import { type Plugin } from 'vuex'
1
+ import { type Plugin , type Store } from 'vuex'
2
2
import { debouncer } from '/src/common/debouncer'
3
3
4
4
import {
5
5
ADD_DOCUMENT ,
6
6
DISCARD_DOCUMENT ,
7
- DOCUMENTS_LOADED ,
8
7
EDIT_DOCUMENT ,
9
8
RESTORE_DOCUMENT ,
10
9
RESTRICT_DOCUMENT ,
@@ -23,20 +22,14 @@ const syncPlugin: Plugin<any> = (store) => {
23
22
switch ( type ) {
24
23
case ADD_DOCUMENT :
25
24
case DISCARD_DOCUMENT :
26
- case DOCUMENTS_LOADED :
27
25
case EDIT_DOCUMENT :
28
26
case RESTORE_DOCUMENT :
29
27
case RESTRICT_DOCUMENT :
30
28
case SET_ONLINE :
31
29
case SET_USER :
32
30
case SHARE_DOCUMENT :
33
31
case TOUCH_DOCUMENT :
34
- // sync documents if online
35
- if ( store . state . online && store . state . auth . user ) {
36
- debounce ( 'sync' , ( ) => {
37
- store . dispatch ( SYNC )
38
- } )
39
- }
32
+ syncDocs ( store )
40
33
41
34
break
42
35
default :
@@ -45,4 +38,13 @@ const syncPlugin: Plugin<any> = (store) => {
45
38
} )
46
39
}
47
40
41
+ export const syncDocs = ( store : Store < any > ) => {
42
+ // sync documents if online
43
+ if ( store . state . online && store . state . auth . user ) {
44
+ debounce ( 'sync' , ( ) => {
45
+ store . dispatch ( SYNC )
46
+ } )
47
+ }
48
+ }
49
+
48
50
export default syncPlugin
You can’t perform that action at this time.
0 commit comments