File tree 3 files changed +10
-3
lines changed
3 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -24,12 +24,14 @@ import {
24
24
} from '@vue/runtime-test'
25
25
import { createApp , defineComponent } from 'vue'
26
26
import type { RawSlots } from 'packages/runtime-core/src/componentSlots'
27
+ import { resetSuspenseId } from '../../src/components/Suspense'
27
28
28
29
describe ( 'Suspense' , ( ) => {
29
30
const deps : Promise < any > [ ] = [ ]
30
31
31
32
beforeEach ( ( ) => {
32
33
deps . length = 0
34
+ resetSuspenseId ( )
33
35
} )
34
36
35
37
// a simple async factory for testing purposes only.
Original file line number Diff line number Diff line change @@ -50,6 +50,11 @@ export const isSuspense = (type: any): boolean => type.__isSuspense
50
50
// incrementing unique id for every pending branch
51
51
let suspenseId = 0
52
52
53
+ /**
54
+ * For testing only
55
+ */
56
+ export const resetSuspenseId = ( ) => ( suspenseId = 0 )
57
+
53
58
// Suspense exposes a component-like API, and is treated like a component
54
59
// in the compiler, but internally it's a special built-in type that hooks
55
60
// directly into the renderer.
@@ -476,7 +481,7 @@ function createSuspenseBoundary(
476
481
hiddenContainer,
477
482
anchor,
478
483
deps : 0 ,
479
- pendingId : 0 ,
484
+ pendingId : suspenseId ++ ,
480
485
timeout : typeof timeout === 'number' ? timeout : - 1 ,
481
486
activeBranch : null ,
482
487
pendingBranch : null ,
Original file line number Diff line number Diff line change @@ -140,8 +140,8 @@ onMounted(() => {
140
140
:preview-options =" {
141
141
customCode: {
142
142
importCode: `import { initCustomFormatter } from 'vue'`,
143
- useCode: `initCustomFormatter()`
144
- }
143
+ useCode: `initCustomFormatter()`,
144
+ },
145
145
}"
146
146
/>
147
147
</template >
You can’t perform that action at this time.
0 commit comments