# Dashboard gadget configuration

**URL:** <https://community.developer.atlassian.com/t/dashboard-gadget-configuration/56617>\
**Category:** Forge Modules and Product Triggers\
**Tags:** gadget\
**Created:** [March 11, 2022, 12:00pm UTC](https://community.developer.atlassian.com/t/dashboard-gadget-configuration/56617 "2022-03-11T12:00:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kbujacek](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/kbujacek/32/42277_2.png) [@kbujacek](https://community.developer.atlassian.com/u/kbujacek)\
**Post date:** [March 11, 2022, 12:00pm UTC](https://community.developer.atlassian.com/t/dashboard-gadget-configuration/56617/1 "2022-03-11T12:00:53Z")

</div>

Hello folks,

Dashboard gadget configuration is related to the [`DashboardGadgetEdit` Jira UI kit component](https://developer.atlassian.com/platform/forge/ui-kit-components/jira/dashboard-gadget-edit/). Function `onSubmit` has this description:

> The `onSubmit` function must be provided for the gadget configuration to be saved. The values returned from `onSubmit` 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:

```auto
  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?

---

<div class="post-metadata">

**Author:** ![mszpyra](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/mszpyra/32/36419_2.png) [@mszpyra](https://community.developer.atlassian.com/u/mszpyra)\
**Post date:** [March 14, 2022, 10:18am UTC](https://community.developer.atlassian.com/t/dashboard-gadget-configuration/56617/2 "2022-03-14T10:18:32Z")

</div>

Hi @kbujacek. You are right that there seems to be discrepancy between docs and the actual implementation. We took over this feature from other team so I need to make sure what was the intended implementation and how we should handle arrays and will get back to you.

---

<div class="post-metadata">

**Author:** ![kbujacek](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/kbujacek/32/42277_2.png) [@kbujacek](https://community.developer.atlassian.com/u/kbujacek)\
**Post date:** [March 14, 2022, 11:07am UTC](https://community.developer.atlassian.com/t/dashboard-gadget-configuration/56617/3 "2022-03-14T11:07:21Z")

</div>

@mszpyra , thanks!

In the meantime, it is possible to save base64 encoded JSON: it works, but it is really weird and inconvenient.

---

<div class="post-metadata">

**Author:** ![mszpyra](https://sea1.discourse-cdn.com/atlassiandeveloper/user_avatar/community.developer.atlassian.com/mszpyra/32/36419_2.png) [@mszpyra](https://community.developer.atlassian.com/u/mszpyra)\
**Post date:** [March 18, 2022, 4:29pm UTC](https://community.developer.atlassian.com/t/dashboard-gadget-configuration/56617/4 "2022-03-18T16:29:19Z")

</div>

Hi @kbujacek, so the documentation is off and we will fix it. The value from submit function is not used as whole configuration object but is added to the existing one.

As for serialisation we fixed the encoding and now the value you get back should be the same that you saved. Arrays should work also. Let me know it works for you and if it solves your use case.
