File tree 1 file changed +19
-2
lines changed
Filter options
packages/core/computedAsync
1 file changed +19
-2
lines changed
Original file line number Diff line number Diff line change 1
1
import type { Fn } from '@vueuse/shared'
2
2
import type { Ref } from 'vue'
3
3
import { noop } from '@vueuse/shared'
4
- import { computed , ref as deepRef , isRef , shallowRef , watchEffect } from 'vue'
4
+ import {
5
+ computed ,
6
+ ref as deepRef ,
7
+ isRef ,
8
+ shallowRef ,
9
+ watchEffect ,
10
+ } from 'vue'
5
11
6
12
/**
7
13
* Handle overlapping async evaluations.
@@ -30,6 +36,16 @@ export interface AsyncComputedOptions {
30
36
*/
31
37
shallow ?: boolean
32
38
39
+ /**
40
+ * The flush option allows for greater control over the timing of a history point, default to `pre`
41
+ *
42
+ * Possible values: `pre`, `post`, `sync`
43
+ *
44
+ * It works in the same way as the flush option in watch and watch effect in vue reactivity
45
+ * @default 'pre'
46
+ */
47
+ flush ?: 'pre' | 'post' | 'sync'
48
+
33
49
/**
34
50
* Callback when error is caught.
35
51
*/
@@ -72,6 +88,7 @@ export function computedAsync<T>(
72
88
73
89
const {
74
90
lazy = false ,
91
+ flush = 'pre' ,
75
92
evaluating = undefined ,
76
93
shallow = true ,
77
94
onError = noop ,
@@ -120,7 +137,7 @@ export function computedAsync<T>(
120
137
121
138
hasFinished = true
122
139
}
123
- } )
140
+ } , { flush } )
124
141
125
142
if ( lazy ) {
126
143
return computed ( ( ) => {
You can’t perform that action at this time.
0 commit comments