Dashboard Gadget with locally cached data

I built a Custom UI dashboard gadget that calls a backend function to collect and process some data. I want the user to be able to switch between the gadget config (edit.js) and the view (view.js) to iterate on tuning some config settings to set up their view exactly the way they want. It’s annoying that the gadget refreshes and hits the backend every time the user switches between the edit and view (by hitting save or cancel on the gadget config).

Has anyone worked out a solution to cache some data in memory on the frontend so the user can quickly iterate between the config and the view? It seems like the app.js, view.js and edit.js are all created and destroyed when the user switches from the config, hits save (or cancel) and goes back to the view, which makes this difficult.

Another variation of the question is has anyone successfully created their own config edit button on the view.js side of a custom ui dashboard gadget and still saved the config in jira’s dashboard config system? When I added a button on my View.js to show the config panel, that worked fine. When I click save, I see an error when the below line of code runs that is trying to store the config.

await view.submit(data)

I see the following error:

Error: this resource’s view is not submittable.
at Object.submit (http://localhost:8000/static/js/bundle.js:56782:11)
at async Object.onSubmit [as current] (http://localhost:8000/main.82f7d25460cf62ed642a.hot-update.js:184:7)