【BUGFIX】修复嵌套列表更新列表后组件实例复用导致动态属性丢失问题 #5507
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
我的疑问是既然这种情况下应该是直接彻底禁止使用动态属性,还是抹平差异让setup中可以通过props直接访问动态属性?
这个疑问的是因为setup中没有动态属性,但是框架在render的前置操作中又会把动态属性attrs中的数据合并到props中,但是该属性有没有在template中使用,则导致框架因为render函数没有使用该动态属性忽略该属性的变化,导致不会触发组件的render,这时列表发生变更,组件仅仅进行了数据层面的更新(该步骤只会复制声明的参数),ui没有更新(原始的vue框架中如果props检测变化则强制更新ui层,修复代码中的
instance.effect.dirty = true
是标记框架需要更新ui),则render的前置复制attrs到props的操作没生效,导致闭包数据错误最小复现代码如下图所示
小程序代码片段
问题现象如下
最小复现demo代码如下

经过排查发现uni内置的vue框架中丢失如下代码