Skip to content

Conversation

@charlzyx
Copy link
Contributor

@charlzyx charlzyx commented Jan 16, 2025

Before submitting a pull request, please make sure the following is done...

  • Ensure the pull request title and commit message follow the Commit Specific in English.
  • Fork the repo and create your branch from master or formily_next.
  • If you've added code that should be tested, add tests!
  • If you've changed APIs, update the documentation.
  • Ensure the test suite passes (npm test).
  • Make sure your code lints (npm run lint) - we've done our best to make sure these rules match our internal linting guidelines.

Please do not delete the above content


修复 #4205 问题

What have you changed?

相比于原来的 splice 方案

array.splice(formIndex, 1); 
array.splice(toIndex, 0, formItem)

会引发的两次length变化, 缺少了这里的 reactions https://github.com/alibaba/formily/blob/v2.3.2/packages/reactive/src/reaction.ts#L140

我猜测这样导致了 array 的引用被认为是没有变化的, ArrayItems 里面的刷新逻辑跟之前有偏差;
这涉及到 react 经典的 为什么尽量不使用数组的 index 做key 与 formliy 响应式模型的一点点冲突;

TODO: 后续我会在深入研究之后在这个pr之后进行补充

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant