Hello folks,
Dashboard gadget configuration is related to the DashboardGadgetEdit
Jira UI kit component. Function onSubmit
has this description:
The
onSubmit
function must be provided for the gadget configuration to be saved. The values returned fromonSubmit
are the values that are saved as the gadget configuration.
When I tried to save a gadget configuration which contains an array from select list (Select
and Option
UI kit components), I’ve noticed, that such array is serialized as a string.
Then I tried to convert this array into object properties (the object returned by the onSubmit
method), like this:
const onSubmit = (values) => {
return {
...values.field.reduce((a, v) => ({ ...a, [v]: true }), {})
}
}
Then I noticed that the returned object is not the one saved as the gadget configuration, but the saved configuration is updated using this return value – all the properties previously saved are untouched and I am not able to delete them.
Is this intended behavior or am I missing something?
What is correct way how to handle selects/options (i.e. arrays) in gadget configuration?