-
Notifications
You must be signed in to change notification settings - Fork 674
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(form): fix form multiple bind visibility #1531
fix(form): fix form multiple bind visibility #1531
Conversation
fn(child) 会调用property._bindVisibility()最终调用到forEachChild,无需重复执行
rootProperty._bindVisibility() 只有根Property执行即可,嵌套的Object Property如果也调用,会造成各属性的_bindVisibility重复执行,visibleIf被重复订阅,引起resetValue被重复执行。
Codecov Report
@@ Coverage Diff @@
## master #1531 +/- ##
==========================================
- Coverage 95.60% 95.60% -0.01%
==========================================
Files 272 272
Lines 8436 8435 -1
Branches 1655 1573 -82
==========================================
- Hits 8065 8064 -1
Misses 310 310
Partials 61 61
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
是否呈现会依赖目标,但是目标是不确定的,基于此问题,能否提供一个复现的示例? |
以下是一个小demo,每次点启用,将触发三次的asyncData的调用。 |
这种状态我认为是合理的,因为我们无法确认是否需要依赖异步数据来做变更动作。
|
不管是否依赖异步数据来做变更动作,三次的reset调用是否有必要。如果这个嵌套再深一层将会有更多次的订阅,而事件的起因是因为依赖的visibleIf只发生一次改变。我们是否有必要因为一次改变而订阅三次,这三次所做的事件是一样的,并没有不同,仅仅是因为多订阅了。 |
当有嵌套Object property时且嵌套的属性中定义了visibleIf,_bindVisibility被重复调用并订阅执行setVisible。当visibleIf发生变化时将重新触发resetValue多次。
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Does this PR introduce a breaking change?
Other information