luya-module-admin icon indicating copy to clipboard operation
luya-module-admin copied to clipboard

Unnecessary (??) ngRest request when changing states

Open Antikon opened this issue 4 years ago • 4 comments

What steps will reproduce the problem?

1. Navigate to Settings -> Layouts.

At least two XHR requests performed:

  • GET http://luyadev/admin/api-cms-layout/list?ngrestCallType=list&fields=id,id,name,json_config,view_file&sort=-id&page=1
  • GEThttp://luyadev/admin/api-cms-layout/unlock

2. Navigate to Themes

There are 5 XHR request perfomed:

  • GET http://luyadev/admin/api-cms-layout/list?ngrestCallType=list&fields=id,id,name,json_config,view_file&sort=-id&page=1
  • GET http://luyadev/admin/api-cms-layout/unlock
  • GET http://luyadev/cmsadmin/theme/index
  • GET http://luyadev/admin/api-cms-theme/services?ngrestCallType=services&fields=id
  • GET http://luyadev/admin/api-cms-theme/list?ngrestCallType=list&expand=name,parentTheme&fields=id,id,name,is_default,base_path,parentTheme&sort=-id&page=1

As far as I understand, the second request releases the lock from the current user, if any. But what the purpose of the first request?

Additional infos

Q A
LUYA Admin Version 4.1.0 (before to replacement in menu)
PHP Version 7.4.13
Platform Apache
Operating system Windows

Antikon avatar Oct 02 '21 11:10 Antikon

You mean the second GET http://luyadev/admin/api-cms-layout/list?ngrestCallType=list&fields=id,id,name,json_config,view_file&sort=-id&page=1:

This is very hard to debug, and yes what you are saying is absolute true, this second requests makes no sense at all. This is maybe because when leaving this angular controller the state changes somewhere which triggers a final $scope.loadList something like this:

https://github.com/luyadev/luya-module-admin/blob/master/src/resources/js/controllers.js#L521-L527

nadar avatar Oct 06 '21 07:10 nadar

Yes, that's exactly what I meant ("first" refers to queries after navigating to "Themes").

Antikon avatar Oct 07 '21 18:10 Antikon

Do you have time for some "console.logs"? I would then try to fix it.

nadar avatar Oct 27 '21 11:10 nadar

Yes. What do you want me to do?

Antikon avatar Oct 27 '21 13:10 Antikon