Closed zorji closed 2 years ago
Jest test to reproduce the issue.
The following test passes in v1.0.3 but fails since v1.1 (I tested with v1.1.5, 1.2, 1.3 and 1.4.0)
Vue version: 2.6.14
import VueCompositionApi, { reactive, watch } from '@vue/composition-api' import Vue from 'vue' Vue.use(VueCompositionApi) describe('watch', () => { it('should trigger watch when reactive changes', (done) => { const pagination = reactive({ page: 0, pageSize: 0 }) watch(pagination, (newPagination) => { expect(newPagination) .toEqual({ page: 1, pageSize: 0 }) done() }) pagination.page = 1 }) it('should trigger watch when reactive changes in array', (done) => { const pagination = reactive({ page: 0, pageSize: 0 }) const filter = reactive({ name: '' }) watch([pagination, filter] as const, ([newPagination, newFilter]) => { expect(newPagination) .toEqual({ page: 1, pageSize: 0 }) expect(newFilter) .toEqual({ name: '' }) done() }) pagination.page = 1 }) })
temporary try this:
watch([pagination, filter] as const, ([newPagination, newFilter]) => { }, {deep:true})
Stale issue message
Jest test to reproduce the issue.
The following test passes in v1.0.3 but fails since v1.1 (I tested with v1.1.5, 1.2, 1.3 and 1.4.0)
Vue version: 2.6.14