openui5 icon indicating copy to clipboard operation
openui5 copied to clipboard

titleChanged Event not propagating across nested components correctly

Open grahamrobbo opened this issue 6 years ago • 7 comments

OpenUI5 version: 1.80.0

Browser/version (+device/version): Chrome Version 84.0.4147.89 (Official Build) (64-bit)

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

Steps to reproduce the problem:

  1. Use demo from @flovogt blog https://blogs.sap.com/2020/03/23/ui5ers-buzz-48-consuming-title-changes-of-nested-components/

  2. Set target title property in BOTH Root Component manifest.json and Suppliers Component manifest.json.

{
    ...,
    "targets": {
        ...,
        "suppliers": {
            "type": "Component",
            "usage": "suppliersComponent",
            "title": "Root Component Supplier Title"
        },
    ...
}
{
    ...,
    "targets": {
        "list": {
            "type": "View",
            "id": "list",
            "type": "List",
            "title": "Supplier Component Supplier Title"
        },
    ...
}
  1. Navigate to Suppliers Component - then do browser refresh. Event titleChanged is propagated from Suppliers Component to Root Component as expected.

image

  1. Remove title property from Root Component manifest.json.
{
    ...,
    "targets": {
        ...,
        "suppliers": {
            "type": "Component",
            "usage": "suppliersComponent"
        },
    ...
}
  1. Perform browser refresh. Event titleChanged is not propagated.

image

It seems the titleChanged event is only propagated when the Root Component has the matching target title property defined.

grahamrobbo avatar Jul 22 '20 00:07 grahamrobbo

I also found that title properties in Root Component manifest.json not only have to be defined but also have to be unique or titleChanged event propagation does not work.

This works.

{
    ...,
    "targets": {
        ...,
        "suppliers": {
            "type": "Component",
            "usage": "suppliersComponent",
            "title": "A"
        },
        "categories": {
            "type": "Component",
            "usage": "categoriesComponent",
            "title": "B"
        },
        "products": {
            "type": "Component",
            "usage": "productsComponent",
            "title": "C"
        },
  ...
}

... this doesn't

{
    ...,
    "targets": {
        ...,
        "suppliers": {
            "type": "Component",
            "usage": "suppliersComponent",
            "title": "A"
        },
        "categories": {
            "type": "Component",
            "usage": "categoriesComponent",
            "title": "A"
        },
        "products": {
            "type": "Component",
            "usage": "productsComponent",
            "title": "A"
        },
  ...
}

grahamrobbo avatar Jul 22 '20 00:07 grahamrobbo

Hi @grahamrobbo , thanks for positing your described scenario. We'll have a look. Best Regards, Florian

flovogt avatar Jul 27 '20 08:07 flovogt

Supplier Component Supplier Title

Hi @grahamrobbo, I executed the described steps. However, removing the title of the target in the root component does still propagating the title for me. Could you provide us your application code, please? So, we'll have a look on that.

flovogt avatar Jul 29 '20 14:07 flovogt

I also found that title properties in Root Component manifest.json not only have to be defined but also have to be unique or titleChanged event propagation does not work.

This works.

{
    ...,
    "targets": {
        ...,
        "suppliers": {
            "type": "Component",
            "usage": "suppliersComponent",
            "title": "A"
        },
        "categories": {
            "type": "Component",
            "usage": "categoriesComponent",
            "title": "B"
        },
        "products": {
            "type": "Component",
            "usage": "productsComponent",
            "title": "C"
        },
  ...
}

... this doesn't

{
    ...,
    "targets": {
        ...,
        "suppliers": {
            "type": "Component",
            "usage": "suppliersComponent",
            "title": "A"
        },
        "categories": {
            "type": "Component",
            "usage": "categoriesComponent",
            "title": "A"
        },
        "products": {
            "type": "Component",
            "usage": "productsComponent",
            "title": "A"
        },
  ...
}

Thats correct. Currently, the title of the different targets have to be different. I'll have a deeper look, if we can improve the feature regards to that.

flovogt avatar Jul 29 '20 14:07 flovogt

Hello @grahamrobbo Thank you for sharing this finding. I've created an internal incident 2080321371. The status of the issue will be updated here in GitHub. Regards, Florian

flovogt avatar Jul 30 '20 13:07 flovogt

Supplier Component Supplier Title

Hi @grahamrobbo, I executed the described steps. However, removing the title of the target in the root component does still propagating the title for me. Could you provide us your application code, please? So, we'll have a look on that.

Hi @grahamrobbo, this issue is closed because the second scenario is fixed. The first scenario is not reproducible from our side. If you still face this issue, please open a new issue and provide a link to a snippet. All the best and thanks a lot for your support, Florian

flovogt avatar Aug 06 '20 11:08 flovogt

Sorry @flovogt I have been on vacation for a few weeks. I have created a sample and opened new issue #2979

grahamrobbo avatar Aug 10 '20 05:08 grahamrobbo