Skip to Content
0
Jul 09, 2020 at 08:27 AM

Reuse Component: Old controller remains?

271 Views Last edit Jul 09, 2020 at 08:36 AM 3 rev

Hello,

I have a reuse component embedded in another app.

I use component based routing. Our UI5 version is 1.71.

When a button is pressed in the parent component, it publishes an event and the child component handles it.

EventBus is used for this purpose.

When the app is executed for the first time after browse refresh, this is successful.

However, when I go back to the launchpad and enter the app again, the same event is received by multiple child controllers.

It looks as if old controller remains and reacts to the event.

What I have done so far are:

1. Unsubscribe to the event in onExit hook of child's controller

2. In child's Component.js, implemented destroy function

destroy: function () {
    UIComponent.prototype.destroy.apply(this, arguments);
}

As a workaround, I checked if the controller is executed for the first time or not.

But I would like to destroy the child component each time the app is closed.

How can I achieve this?

Best regards,

Mio

Attachments

pic1.png (22.6 kB)