What mistake have I made!?

Welcome all my friends.
I’m having a little problem, which is that I want to show Dialog and make a functional choice
Then I want Dialog to reappear automatically after the command is executed to complete something for example.
This is my code:

const ImportDialog = async (callback) => {
    const res = await document.querySelector("#ImportDialog").uxpShowModal({
        title: "RETOUCHPRO 5 UXP",
        resize: "both", // "horizontal", "vertical", "none"
        size: {
            width: 250,
            height: 250
        }
    })
    console.log(`The dialog closed with: ${res}`)
    if (typeof callback === 'function') {
        callback(res);
    }
    const dialogCallback = (dialogResponse) => {
        console.log(dialogResponse);
        // do whatever with that response
        let color = document.querySelector("#Export").value;
        if (!color) {
            Export();
            return;
        } else if (color == "me") {
            await suspendHistory("openFiles", openFiles); //WORK...
        } else if (color == "me1") {
            await suspendHistory("openImge", openImge); //WORK...
        }
    }
}

When the code is executed, the panel freezes
When deleted, the panel returns to work again.

With regards … :pray:
Mohamed Fathi… :wine_glass:

Did you try to debug line by line and see what freezes your panel?

I try and share the results here :slightly_smiling_face: