Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

todoitems.json is not loaded via Component-preload.js #109

Closed
KeKsBoTer opened this issue Mar 3, 2021 · 2 comments
Closed

todoitems.json is not loaded via Component-preload.js #109

KeKsBoTer opened this issue Mar 3, 2021 · 2 comments
Labels

Comments

@KeKsBoTer
Copy link

I just cloned the repo and built it using npm run build and then npm run serve-dist to serve the app.
I realized that the file webapp/model/todoitems.json is in Component-repload.json but is loaded separately via a HTTP GET request.

Is this intended?
Is there a way to avoid the additional request and use the Component-preload?
Otherwise I think the todoitems.json should be removed from the Component-preload.

Tested with following versions:

  • @ui5/cli 2.10.0
  • OpenUI5 1.87.0
@RandomByte
Copy link
Member

Hi Simon, good observation!

The additional request is indeed intended. The JSON Model takes care of loading data by itself. In typical scenarios the model data might change or come from a different host. There's not really a use case for having it statically as part of the project resources while still asking the JSON Model to load it, since you could just pass the json to the model directly.

And of course you are right: In this case the JSON should not be part of the Component-preload.js bundle. This is actually an issue of the UI5 Tooling which we also spotted in a different context a while ago. A fix is already in the making: SAP/ui5-builder#580

@RandomByte
Copy link
Member

The fix has just been released as part of UI5 CLI v2.10.1 and can be tested on the current master of the openui5-sample-app 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants