gloriasoft / veaury

Use React in Vue3 and Vue3 in React, And as perfect as possible!
MIT License
1.27k stars 81 forks source link

watch does not work for children of applyPureReactInVue #122

Closed nhaustov closed 4 months ago

nhaustov commented 4 months ago

We are using watch on ref to attach something to diff when it is initialized (not on mount). It works when div is a child of Vue component or simple diff but not with children of applyPureReactInVue component. Attached is a minimized example under dev-project-vue3 (watchref). The refs are initialized 3 seconds after the component is mounted and then changed after another 3 seconds. It works for box2 and box3 but not for box1. In the console output is below - note no "box1 changed". The problem also happens with 2.3.17-beta.1 (with fix to #120).

diff.txt

box1 undefined index.vue:48 box2 undefined index.vue:49 box3 undefined index.vue:39 box2 changed

​ undefined undefined index.vue:43 box3 changed
​ undefined undefined index.vue:39 box2 changed null
​ undefined index.vue:43 box3 changed null
​ undefined index.vue:39 box2 changed
​ null undefined index.vue:43 box3 changed
​ null undefined

devilwjp commented 4 months ago

@nhaustov try 2.3.17

The execution results of the use case are as follows. Although the situation of watching changes in box1 is different from that of box2 and box3. When the responsive variable 'show' changes from 1 to 2, the value of box1 will not be null for a moment. I think it is more reasonable. image