SAP / openui5

OpenUI5 lets you build enterprise-ready web applications, responsive to all devices, running on almost any browser of your choice.
http://openui5.org
Apache License 2.0
2.95k stars 1.23k forks source link

uploadSet-uploadButton doesn't destroy when closing dialog #3938

Closed loatherer closed 8 months ago

loatherer commented 8 months ago

OpenUI5 version: 1.108.14

Browser/version (+device/version): Google Chrome/ Version 120.0.6099.110

Any other tested browsers/devices(OK/FAIL):

URL (minimal example if possible): https://plnkr.co/edit/lWD7gBZFod2HQRcf?preview

Steps to reproduce the problem:

  1. Open Dialog
  2. Drag a file on to the drag drop area (don't drop the file to the drag and drop area).
  3. Close Dialog
  4. Open Dialog

What is the expected result? The dialog should open. What happens instead? Dialog doesn't open. Any other information? (attach screenshot if possible) image

image

dobrinyonkov commented 8 months ago

Hello @loatherer,

this seems to be an issue with the oDialog references.

Please adjusted your code as follows so that it works with the correct references:

sap.ui.define(
    ["sap/ui/core/mvc/Controller", "sap/ui/core/Fragment"],
    function (Controller, Fragment) {
        "use strict";

        return Controller.extend("sap.ui.demo.walkthrough.view.App", {
            getDialog: async function () {
                if (!this.oDialog) {
                    this.oDialog = await Fragment.load({
                        id: this.getView().getId(),
                        name: "sap.ui.demo.walkthrough.view.Dialog",
                        controller: this,
                    });
                    this.getView().addDependent(this.oDialog);
                }

                return this.oDialog;
            },
            onOpenDialog: function () {
                this.getDialog().then((oDialog) => {
                    oDialog.open();
                });
            },
            closeDialog: function () {
        this.getDialog().then((oDialog) => {
                    oDialog.close();
                });
            },
        });
    }
);

If you for some reason need to destroy the dialog before you close it the code should look like so:


            getDialog: async function () {
                if (!this.oDialog) {
                    this.oDialog = await Fragment.load({
                        id: this.getView().getId(),
                        name: "sap.ui.demo.walkthrough.view.Dialog",
                        controller: this,
                    });
                    this.getView().addDependent(this.oDialog);
                }

                return this.oDialog;
            },
            onOpenDialog: function () {
                this.getDialog().then((oDialog) => {
                    oDialog.open();
                });
            },
            closeDialog: function () {
                this.getDialog().then((oDialog) => {
                    oDialog.close();
                    oDialog.destroyContent();
                    oDialog.destroy();
                    this.oDialog = null;
                });
            },

Let me know if you face any issues with the refactored code.

Kind Regards, Dobrin

loatherer commented 8 months ago

Hello @dobrinyonkov , Thanks for your fast response, i created a new plunkr according to your code however my problem still occurs when i destroy the dialog and try to open it. Plnkr: https://plnkr.co/edit/Ne4WB6EXLXq5gIMu?preview

Plnkr: plnkrPopupUploadSetDuplicate2

On my machine : plnkrPopupUploadSetDuplicate1

Regards, Mete