SAP / ui5-webcomponents

UI5 Web Components - the enterprise-flavored sugar on top of native APIs! Build SAP Fiori user interfaces with the technology of your choice.
https://sap.github.io/ui5-webcomponents/
Apache License 2.0
1.58k stars 271 forks source link

ui5-menu: dynamically loaded items disappear on menu reopening #7423

Closed unazko closed 8 months ago

unazko commented 1 year ago

Bug Description

Hello colleagues,

The issue is reproducible in the ui5-menu dev sample and here is the code:

<ui5-menu id="menu">
    <ui5-menu-item text="Open">
        <ui5-menu-item text="Open Locally"  busy-delay="100" busy>
    </ui5-menu-item>
<ui5-menu>
let fetched = false;

menu.addEventListener("ui5-before-open", function fetch(event) {
    const item = event.detail.item;
    if (item && item.text === "Open Locally" && !fetched) {
        setTimeout(function() {
            item.removeAttribute("busy");
            item.removeAttribute("busy-delay");
            let cNode= document.createElement("ui5-menu-item");
            cDone.setAttribute("text", "Open from C");
            let dNode= document.createElement("ui5-menu-item");
            dNode.setAttribute("text", "Open from D");
            item.append(cNode, dNode);
            fetched = true;
        }, 1000);
    }
});

Affected Component

ui5-menu

Expected Behaviour

The linked sub-menu to the "Open Locally" menu item has it's items from the previous opening displayed.

Isolated Example

No response

Steps to Reproduce

  1. Open the development sample
  2. Navigate to the "Open Locally" menu item
  3. Wait while the corresponding sub-menu gets opened and items are added in it
  4. Press ESC to close the menu and repeat the same steps

Observed: The linked sub-menu to the "Open Locally" menu item doesn't have any menu items and is stuck in busy state.

Expected The linked sub-menu to the "Open Locally" menu item has it's items from the previous opening displayed.

Log Output, Stack Trace or Screenshots

No response

Priority

Medium

UI5 Web Components Version

latest

Browser

Chrome

Operating System

Windows

Additional Context

No response

Organization

No response

Declaration

unazko commented 1 year ago

Hello @SAP/ui5-webcomponents-topic-b,

This issue if for us to fix.

Best regards, Boyan

unazko commented 9 months ago

Hello colleagues,

Currently the issue is not reproducible as it was described before. Yet there is a similar issue with the same sample, which could be reproduce by following these steps:

  1. Open the development sample
  2. Navigate to the "Open Locally" menu item
  3. Press ESC to close the menu and repeat the same steps before the busy state gets resolved
  4. Repeat the first two steps, in order to open the "Open Locally" sub-menu

Expected: Only two ui5-menu-item's are added

Observed: Four ui5-menu-item's are added

This issue will be resolved via the related PR.