You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The reason I don't ensure whether this behavior is an issue is maybe it is designed deliberately, anyway, if we invoke form.setValues with non-empty values, it works as expected.
In this case, I think it is a little bit confusing for an empty string. Sometimes, the empty string also has a special meaning at the business level, maybe we should not fallback it simply by isEmpty assertion.
Note: I found similar issues, eg #2901, #2629 but not sure they are same.
The text was updated successfully, but these errors were encountered:
This logic of restoring the scene by default is specially designed. If you want not to go to the cache, you can call reset or manually clear the cache.
Reproduction link
Steps to reproduce
What is expected?
the input field with the name
aaa
should be empty because I invokeform.setValues
inApp.tsx@69
.What is actually happening?
the input field with the name
aaa
persisted with the previous value and thefield.value
has changed to it.Package
@formily/[email protected]
@formily/[email protected]
Although I am not using
FormStep
directly, I implemented a similar one according to its source code and found this issue(maybe not).After debugging, I found the root cause is as following:
FormStep
invokesetDisplay
method and update thefiled.visible
, see:formily/packages/antd/src/form-step/index.tsx
Lines 81 to 83 in 2b8e705
Field
model reactive to this update and rollback the field value incaches
, see:formily/packages/core/src/models/Field.ts
Lines 246 to 250 in 2b8e705
The reason I don't ensure whether this behavior is an issue is maybe it is designed deliberately, anyway, if we invoke
form.setValues
with non-empty values, it works as expected.In this case, I think it is a little bit confusing for an empty string. Sometimes, the empty string also has a special meaning at the business level, maybe we should not fallback it simply by
isEmpty
assertion.Note: I found similar issues, eg #2901, #2629 but not sure they are same.
The text was updated successfully, but these errors were encountered: