Open andlbrei opened 5 days ago
I don't think we can use defaultValue
when calling remove('/PEP/persons')
– but we should make it work to use use emptyValue
.
Ah, so the problem is that the field in the array has a defaultValue
.
I see that it doesn't crash when I remove the defaultValue
on the boolean field.
It also applies the defaultValue
defined on the Iterate.Array
correctly when pressing "Ja" and I check a checkbox again after.
So this is a bit strange perhaps?
🐛 Bug Report
When working with
Visibility
, toggling between removing a value usinguseData().remove()
when hiding and then showing the fields related to to removed value causes an error.I notice that after removing a value, it's not actually removed, but is set to
undefined
. In another case, which is not relevant any more, I usedset()
to get the value properly removed from the data, but I don't think that is a very elegant solution.Could/should
remove()
remove the key as well as the value from the data? Or are there better ways to handle removing values when hiding them to avoid them being part of submitted data?https://github.com/user-attachments/assets/00062ac1-c675-4f1a-9804-fe8f10b34434
To Reproduce
Steps to reproduce the behavior:
https://codesandbox.io/p/sandbox/remove-data-on-hide-swf6zr
Expected behavior
I expect the
Fields
to initialize the same way they do when they are first rendered when I show them after having removed them viaremove()
.Eufemia Version
10.53.0