I ran into this in my plugin project and decided to create a blank brand new project just to isolate this issue. So I have this plugin “my-test” that just adds a command to the Plugins drop down Plugins > my-test > My Test Command. When that is triggered, I just have it opening a dialog with showModal and running executeAsModal. This is the test code I have:
const {core} = require('photoshop');
const uxp = require('uxp');
uxp.entrypoints.setup({
plugin: {
create() {
console.log("Plugin has been loaded, plugin. create has been triggered.");
},
destroy() {
return new Promise(function (resolve, reject) {
console.log("destroy has been triggered.");
resolve();
});
}
},
commands: {
showDialog
}
});
async function showDialog() {
await core.executeAsModal(async()=>{},{})
const dialog = document.getElementById("dialog");
dialog.showModal();
}
So this works fine. I have a dialog element with the id “dialog” in my html. it opens up a modal and will run anything I put inside the executeAsModal.
The problem is that after I do that once and close the dialog. My command is disabled in the dropdown UI:
If I remove the call to showModal, the issue doesnt reproduce. If I remove the “executeAsModal”, the issues doesnt reproduce either. It seems like only when these two are in the same command callback? I doesn’t matter if the executeAsModal has anything in its target functions or not. It doesn’t matter if I call one before the other. I get the same result. Is there something that I have to call “resolve” on or something? Is this a bug?