[Koha-bugs] [Bug 32494] New: Potentially expensive API calls made for conditional template rendering

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Mon Dec 19 18:33:40 CET 2022


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32494

            Bug ID: 32494
           Summary: Potentially expensive API calls made for conditional
                    template rendering
 Change sponsored?: ---
           Product: Koha
           Version: master
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P5 - low
         Component: ERM
          Assignee: jonathan.druart+koha at gmail.com
          Reporter: matt.blenkinsop at ptfs-europe.com
                CC: jonathan.druart+koha at gmail.com,
                    jonathan.field at ptfs-europe.com,
                    martin.renvoize at ptfs-europe.com,
                    pedro.amorim at ptfs-europe.com

Bug 32474 introduces ajax based scrolling in v-selects to reduce expensive API
calls. Within ERM there are components where an API call is made and then
sections of template are conditionally rendered depending on whether the call
returns any data. For example, LicensesList.vue requests a list of all licenses
and then renders a div containing a table if "licences.length" is true. The
table then makes the same API call again to fetch the data to populate the
table. The initial API call is therefore not relevant to the table data and if
there is a large number of licenses, this will be an expensive call to make
simply to render the table before making the same call again.

I would suggest that the initial API call needs to be paginated to return a
small amount of data to pass the licenses.length conditional check. The change
proposed in bug 32474 in fetch.js allows fetchLicenses to be called with a
parameter to paginate to just one page like this: "fetchLicenses(1)". We will
then only be fetching one page of 20 values to pass the check. 

N.B. in bug 32474 components with a v-select have already been paginated e.g.
AgreementLicenses.vue - this bug is to patch the components that have not been
modified already, such as LicensesList.vue

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list