We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e67940f commit e754a63Copy full SHA for e754a63
test/v3/runtime-core/apiWatch.spec.ts
@@ -532,6 +532,28 @@ describe('api: watch', () => {
532
expect(data2.value).toMatchObject([1])
533
})
534
535
+ // #498
536
+ it('watchEffect should not lead to infinite loop when accessing', async () => {
537
+ let dummy = 0
538
+
539
+ const state = reactive({
540
+ data: [],
541
+ watchVar: 123,
542
+ })
543
544
+ watchEffect(() => {
545
+ // accessing
546
+ state.watchVar
547
+ // setting
548
+ state.data = []
549
+ dummy += 1
550
551
552
+ expect(dummy).toBe(1)
553
+ await nextTick()
554
555
556
557
it('watching deep ref', async () => {
558
const count = ref(0)
559
const double = computed(() => count.value * 2)
0 commit comments