Custom app widget not visible after navigating

We built a custom app that is embedded in ticket_requester_info and should be rendered upon the event app.activated. This usually works well on the first ticket I open or sometimes after I refresh the page with CTRL+F5 (regular F5 is not enough), but if I navigate to another page in Freshdesk and then back to a ticket, the area where the app should be embedded stays empty.

There is an error in the console:

Uncaught (in promise) ReferenceError: app is not defined
    at init (app.js:4:25)
    at app.js:1:1

But to be fair, it is also there when the app is working, so that probably refers to something else.

Any idea how to fix this problem?