ever-co / ever-gauzy

Ever® Gauzy™ - Open Business Management Platform (ERP/CRM/HRM/ATS/PM) - https://gauzy.co
https://gauzy.co
GNU Affero General Public License v3.0
2.26k stars 533 forks source link

Fix: API optimization for faster response #4090

Open rahul-rocket opened 2 years ago

rahul-rocket commented 2 years ago

It looks like we load tons of APIs during first page load, e.g. we load changelog, while we should be actually loading that only if user click on icon in the site header.

Also, for Clients page we are loading too many other data which I am not sure we need at all (maybe we load it by mistake on all pages!??)

image (40)

It's 24 API requests (not counting all other requests which total to 160!) E.g. why we load countries list!? E.g. we also loading languages list.

Somewhere we also load https://api.gauzy.co/api (no idea why :smile: as it's just return 200)

(don't see diff from countries, no idea how it's used, but both should be possible I think to load on-demand, i.e. when needed / lazy)

There is also weird POST to https://maps.googleapis.com/maps_api_js_slo/log?hasfast=true

There is also call to [https://api.gauzy.co/api/employee/working/count] which return working count!? For page where we did not even display that info.

We never really optimized anything, but this ^ looks like bug fixing more to me.

Btw, good page to check is [https://app.gauzy.co/#/pages/organization/vendors] It's basically empty page, only display Vendors list and it still doing 18 requests. Some of those are needed (e.g. load chat) But many still can be done lazy.

evereq commented 1 year ago

From Slack

1) For [https://api.gauzy.co/api/employee/working/count] - Employee Count -> We have employee selector in the header which is hide/show for specific page. So we are using employee count API to display that selector.

2) For clients page we are loading too many other data which I am not sure we need at all (maybe we load it by mistake on all pages!??) -> We are all loading data are needed because we displaying in smart table and using in Edit form.

3) Why we load countries list!? -> Countries loading on clients page because we have Country dropdown for Client location tab.

4) We also loading languages list. -> We have to use systemLanguages for Gauzy Theme on initial gauzy loads, that's why we are loading that API.

5) Somewhere we also load https://api.gauzy.co/api (no idea why 😄 as it's just return 200) -> We are using such API for check Server Connection periodically so if connection down, so we can show them maintenance page.

6) There is also weird POST to https://maps.googleapis.com/maps_api_js_slo/log?hasfast=true -> No sure why it is loading