alibaba / formily

📱🚀 🧩 Cross Device & High Performance Normal Form/Dynamic(JSON Schema) Form/Form Builder -- Support React/React Native/Vue 2/Vue 3
https://formilyjs.org/
MIT License
10.93k stars 1.42k forks source link

[Bug Report] 调用ArrayItems.Remove后$index没有更新 #4100

Closed wy-luke closed 2 months ago

wy-luke commented 4 months ago

Reproduction link

Edit on CodeSandbox

Steps to reproduce

  1. 添加两个条目
  2. 点击两个编辑按钮,分别会打印出index为0和1
  3. 删除第一个元素,然后再点击编辑按钮,打印出来的还是1,而不是0,$index没有更新。但是$self.index是正确的。

What is expected?

$index随着真实index更新

What is actually happening?

$index只有初始化时进行赋值,没有再更新,闭包了吧

Package

@formily/antd-v5@2.3.1


wy-luke commented 4 months ago

P.S. 原有的CodeSandbox的模版都失效了,加载不出来

charlzyx commented 2 months ago

用 $self.index , 这个是响应式的

wy-luke commented 2 months ago

用 $self.index , 这个是响应式的

后面也是用了这个,既然 $index 设计如此,我就关了 ISSUE 了