Bug 33024

Summary: Lazy load the components in the routes definition
Product: Koha Reporter: Jonathan Druart <jonathan.druart>
Component: ERMAssignee: Jonathan Druart <jonathan.druart>
Status: NEW --- QA Contact:
Severity: major    
Priority: P5 - low CC: dcook, jonathan.druart, jonathan.field, julian.maurice, martin.renvoize, matt.blenkinsop, paul.derscheid, pedro.amorim
Version: unspecified   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36674
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 33024: (DO NOT PUSH): Test example

Description Jonathan Druart 2023-02-21 15:03:06 UTC
In routes/erm.js we should lazy load the components

https://vuejs.org/guide/components/async.html
Comment 1 Jonathan Druart 2024-04-23 08:23:08 UTC
I didn't manage to provide a good solution for this problem.
Can I get some help on this one please? I think it must be fixed for 24.05.
Comment 2 Matt Blenkinsop 2024-04-23 08:52:18 UTC
Created attachment 165357 [details] [review]
Bug 33024: (DO NOT PUSH): Test example

Apply patch, run yarn js:build
The AgreementsShow and AgreementsFormAdd components are bundled separately, AgreementsList isn't but maybe that is an issue with it being the parent route?
Comment 3 Matt Blenkinsop 2024-04-23 08:54:01 UTC
Looking at this page it says not to use async components for routes: 

https://router.vuejs.org/guide/advanced/lazy-loading.html

The test patch uses the method above - if you run yarn build you can see two of the Agreements routes are bundled separately. AgreementsList isn't but I think this might be because it is the parent route for the agreement components?

Just an example for discussion for now, this may not be what you were looking for
Comment 4 Jonathan Druart 2024-04-23 09:53:11 UTC
I actually commented on the wrong bug, but thanks Matt for your patch!

I meant... a bug that I hadn't opened yet! But it exists now, see bug 36674!
Comment 5 Martin Renvoize (ashimema) 2024-06-10 16:07:28 UTC
Confused.. what's the current state of this one then?
Comment 6 David Cook 2024-06-11 04:48:18 UTC
Nice one, Matt. 

I wonder if this should be an umbrella bug and individual reports could look at using the lazy loading for a small group of components?

Or are we still looking into why AgreementsList isn't bundled separately?