UI5 / Fiori loading a JSON Model

Viewed 14

I maintain a Fiori app that has been running for 2 years without any problems. Suddenly there are various errors that can be traced back to a place where I try to load a local JSON model.

The error is

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'indexOf')

This is the code

var sSelectedFilterButtonId = this.getModel("misc").getProperty("/ButtonId");
[... more stuff]
if (sSelectedFilterButtonId.indexOf("Demand") > -1) { ... >>>> error

I'm not a JS pro and suspect that loading the model is asynchronous (as the error said "In Promise"). But there is nothing about this or any async in the UI5 API. It has worked for the last few years. Can someone explain this to me? Or do I have to proceed differently here?

Even more strange is that the error usually only appears when navigating to the app from the Fiori Launchpad. If you reload the app itself, 99.9% of the time no error occurs....

0 Answers
Related