Key/Value component mapped value not functioning properly when reset

Something is wrong with Key-Value components. If you set a mapped value, then decide to clear it out, the actual value will no longer show up. It appears to use an empty string as the value after this clearing.

Furthermore that same "" shows during the value preview before any map is set and when the actual data source raw value is used. Very confusing.

As a workaround, you can set {{self}} to show the value again, however that shouldn't be necessary and I'm wary of using that hack across my apps because it's a redundant "mapping" that shouldn't be necessary.

This may relate to a recent issue I reported to Support regarding tables seemingly able to be corrupted such that columns remain despite a wholly removed data-source. I am posting here (instead of directly to support) for transparency to, and possible benefit for, other users.

0:21s video exhibiting the issue in a bare test app:

Some screenshots:

Hi @dguzzo, thank you for reporting this bug! It should be fixed now and please let me know if you notice any more bugs or have any feedback regarding the key value component! Much appreciated :grinning:

In addition to this subject, at the moment you use mapping on a KeyValue component, I often (always?) get a Javascript error. Even if you delete the mapping, the error stays. In the attached example, I've mapped a ternary operator to change the value depending on a switch. The switch and data worked out as it should (the data changed at the moment the switch was toggled), but the moment the {{self}} status was result of the ternary, the component showed up with the error . Even after removal of the operator, and replaced the mapping to {{self}} (as described as in this post) - it still keeps triggering on the switch.

KeyValueJavaError

Thanks @michaelzhu; I can confirm that the issue has been fixed.

1 Like

Hey @Ronaldvm!

Would you mind sharing how you have your ternary configured? I'm trying to reproduce the behavior with the following setup but to no avail:

It would helpful if we could look at the data being passed to the component as well!

Thanks for your response,

hereby a screenshot of the situation, including the ternary - in the two situation (with/without switch). Even if I remove the ternary, the switch still functions, and the error remains (see last screenshot)

You are more as welcome to take a look at my project and the passed data.



Just want to share @Ronaldvm's solution here :slightly_smiling_face:

It looks like there was an array getting passed to self and using the following ternary cleared it up!

{{ intakeHuidigeWaardesSwitch.value ? clientSelect.selectedItem.voornaam : self[0]}}