question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

sap.ui.core.UIComponent: Manifest-based routing target title formatter not working

See original GitHub issue

OpenUI5 version:

1.42.7 (latest)

Browser/version (+device/version):

Google Chrome 55.0.2883.87 on Windows 7

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

Internet Explorer 11 on Windows 7 (FAIL)

URL (minimal example if possible):

With manifest (FAIL): https://formatterbug-p1940442392trial.dispatcher.hanatrial.ondemand.com/manifest/index.html Without manifest (OK): https://formatterbug-p1940442392trial.dispatcher.hanatrial.ondemand.com/component/index.html

Steps to reproduce the problem:

  1. Simply open the URL and observe the document’s title.

What is the expected result?

The global function someGlobalFunction (defined in the index.html file) should be called to format the title and, as a result, the title of the page should be formatted accordingly (it should be ‘TITLE’ - uppercase).

What happens instead?

The global formatter function is not called and the un-formatted string is propagated as the title instead (the title is ‘Title’ - not uppercase).

Any other information? (attach screenshot if possible)

This happens because the manifest entry JSON is passed directly to the constructor of the sap.ui.core.routing.Targets class, which in turn instantiates the Target, which in turn instantiates the TitleProvider and directly passes the title specification (from the manifest). When building the property or composite binding, the proxy to the formatter function is built by using the name of the function (as passed in the manifest) and not a reference to the function itself.

When using the plain component configuration, the formatter function is called because a function reference is passed instead of the function name (which is not possible inside a JSON file).

Screenshot

There are, IMO, two ways of fixing this:

  • Either add a check inside the _bindProperty method of the ManagedObject to check if the formatter function is a string or a function. (I would say that this would not be the way to go, as it affects more scenarios; should it be possible to pass a function name when programmatically binding a property?).
  • Process the manifest entry inside the UIComponent constructor to transform the routing manifest entry and replace all formatter function names with function references. This is the solution I would suggest. If this is confirmed as a bug, I would be happy to contribute a fix.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
codeworriorcommented, Jan 11, 2017

I would add another proposal for a fix: prevent interpretation of manifest data as binding configuration.

It is IMHO not intended that anything from the manifest.json is ever interpreted as a UI5 data binding configuration. This only happens because manifest data is propagated to the router 1:1. Maybe, even the router should prevent this when propagating the title.

The manifest.json is meant to be independent from a concrete runtime and using runtime specific binding syntax in it contradicts that idea.

0reactions
stopcodercommented, Feb 8, 2017

Hi,

the fix for this issue is merged to nightly build already. And will also be included in openui5 version 1.44.7 and 1.42.10.

Best regards, Jiawei

Read more comments on GitHub >

github_iconTop Results From Across the Web

SplitApp Routing and Views Error in Manifest.json
Hello SAP !!! I have developed an simple "SplitApp" the Master-Detail. After converting View(s) instance from Component.js (in creatContent ...
Read more >
How to resolve the error: "The target [...] no viewName defined"?
Solution. Either add "async": true to /sap.ui5/routing/config/ in manifest.json. Or preferably add "sap.ui.core.
Read more >
sap.ui.core.routing.Targets - API Reference - SAPUI5 SDK
Provides a convenient way for placing views into the correct containers of your application. The main benefit of Targets is lazy loading: you...
Read more >
SAPUI5 Component.js file and SAPUI5 Manifest file - Part 3
The SAP Fiori Launchpad behaves like an application container and it does not need the index.html file with the bootstrap to instantiate the...
Read more >
3 Ways You Can Use the Manifest.json File in SAP HANA
Afterwards, your controllers can make routing calls. To walk through how this works, consider the routing call: “sap.ui.core.UIComponent.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found