Setters after initializing values #1258
-
I remember there was a release on preventing setters to overwrite the initial values but I still have this issue! the weird part is that I can't reproduce it in codesandbox. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 9 replies
-
@Ali-Zmn this might be a silly question but I have to ask. Do you have the latest version of the library installed? If that is the case I guess it would not be possible to give us a peek at your env so we can debug it properly? |
Beta Was this translation helpful? Give feedback.
-
I think the issue is that we check if the field is |
Beta Was this translation helpful? Give feedback.
-
@Ali-Zmn We are just looking at your example and we have found the issue. The good news is we can fix your example. If you remove the {
component: "textField",
name: "schemaVersion",
initialValue: "1.1.0",
- initializeOnMount: true,
hideField: true
} So why is this happening? Due to final form limitations, we have to call the So you will have to set the value somewhere else. Preferably in your initial values object that you feed to the renderer. The bad news is that we won't be able to properly solve the issue until we migrate to your custom state management library which is currently in progress. |
Beta Was this translation helpful? Give feedback.
@Ali-Zmn We are just looking at your example and we have found the issue.
The good news is we can fix your example. If you remove the
initializeOnMount
from your schema version, the setters start to behave as they should.{ component: "textField", name: "schemaVersion", initialValue: "1.1.0", - initializeOnMount: true, hideField: true }
So why is this happening? Due to final form limitations, we have to call the
change
method for fields with this flag. This will mark the for as modified, opening the gates for setters.So you will have to set the value somewhere else. Preferably in your initial values object that you feed to the renderer.
The bad news is…