My Adobe XD Panel Plugin forgets choices when switching out of plugins panel - is there a way to freeze data?

Hello i have my own custom JavaScript Panel plugin that i created from scratch.
Everything is working fine.
However, in my panel, i have input boxes, drop down menus, pick folder button and all these other data selections that work just fine.
However, my issue is that whenever i switch to the layers panel and back again, everything gets reset. All my drop downs, my folder selection and any other inputs that i made are gone. It looks just as if i opened the panel fresh again.

Is there a way to remember all my data and selections i made without losing it when i switch out of the PLUGINS panel?


Your panel should not be resetting whenever you switch back to it, unless you’ve got some code that is reloading on error, or refreshing the panel in response to, say, the update event. We’d need to see some code, though, to help more. If you can repro this with any of the sample projects, that would help.

heres a sample of my code… are you able to see anything that may be off

You’re resetting & rebuilding the panel every time show() is called; you only need to do this step once. Once created, show() should not do anything (unless you want to focus a widget)

Take a look at this example (plugin-samples/main.js at master · AdobeXD/plugin-samples · GitHub) – in it, you’ll notice that create() returns the previously created HTML DOM if it’s called multiple times – this is what you’ll want to do in your case as well.

Without this, you’re just clobbering and rebuilding the UI, which is why you’re seeing everything reset.

1 Like