fix(runtime-core):v-for ref behaves differently under prod and dev #6697#6714
fix(runtime-core):v-for ref behaves differently under prod and dev #6697#6714yyx990803 merged 9 commits intovuejs:mainfrom
Conversation
|
wdyt? @yyx990803 😂 |
| const oldRef = oldRawRef && (oldRawRef as VNodeNormalizedRefAtom).r | ||
| const refs = owner.refs === EMPTY_OBJ ? (owner.refs = {}) : owner.refs | ||
| const refs = | ||
| owner.refs === EMPTY_OBJ ? (owner.refs = reactive({})) : owner.refs |
There was a problem hiding this comment.
I don't think this is the right fix. "Options API" refs haven't been reactive in Vue 2 or Vue 3. The only way to get a reactive ref is through using a an actual ref()/reactive() object like in the reported issue.
Do you mean these two lines? Lines 101~102 |
|
The fix is close - the root cause is that in unmount / already array branches, we are only mutating the refs array, however the array is non-reactive when we get it from the When in dev mode or the binding ref is returned from setup(), the existing value should be retrieved from I made the small change to reflect this logic and reused the test. |
…en prod and dev (vuejs#6714) fix vuejs#6697
…en prod and dev (vuejs#6714) fix vuejs#6697
close: #6697