字段模型的unmount属性是否需要决定字段跳过校验 #2372
janryWang
started this conversation in
Show and tell
Replies: 3 comments 5 replies
-
|
我觉得这个 PR 不能撤回吧:
|
Beta Was this translation helpful? Give feedback.
5 replies
-
|
或者 |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
这个问题只有在用户受控setState去控制某个Field组件显示隐藏会导致提交保留校验,但是如果用到了这种模式,用户自己手动删除字段,其实才是合理的,参考 https://v2.formilyjs.org/zh-CN/guide/advanced/controlled#%E5%AD%97%E6%AE%B5%E7%BA%A7%E5%8F%97%E6%8E%A7 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
之前没有想清楚unmount与字段校验的关系,接收了该PR。#2066
导致引起ArrayTable无法分页的问题:#2358
目前需要回滚该逻辑,主要是因为 组件的卸载,其实并不代表字段被删除,仅仅只是试图上的一个状态体现,如果基于该状态来跳过校验,那必然会存在很多场景上的冲突问题,最典型的就是ArrayTable分页,或者虚拟滚动场景。
目前唯一确定的逻辑是,字段的display为none或者hidden时,和pattern不为editable时,是肯定会跳过校验的,因为这个是100%可以确定当前字段是不需要校验的
需要注意的是,回滚该逻辑,会造成Break Change,大家需要关注,自己是否存在依赖受控卸载字段来控制字段校验的逻辑,如果存在,请改为正常的修改字段的display:none/hidden这种模式来控制
涉及到的版本为2.0.0-rc.5以后的版本
Beta Was this translation helpful? Give feedback.
All reactions