Bug 41173

Summary: ERM breadcrumb link causes page reload
Product: Koha Reporter: Pedro Amorim <pedro.amorim>
Component: ERMAssignee: Tomás Cohen Arazi (tcohen) <tomascohen>
Status: Signed Off --- QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: david, jonathan.druart, jonathan.field, martin.renvoize, matt.blenkinsop, pedro.amorim, tomascohen
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39320
GIT URL: Initiative type: ---
Sponsorship status: --- Comma delimited list of Sponsors:
Crowdfunding goal: 0 Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
This fixes an issue with the breadcrumb links in the ERM module. The ERM landing page with the dashboard now loads correctly. (This is related to bug 39320 - Create a 'landing page' for ERM.)
Version(s) released in:
Circulation function:
Bug Depends on: 39320    
Bug Blocks:    
Attachments: Bug 41173: Fix ERM breadcrumb causing page reload
Bug 41173: Fix ERM breadcrumb causing page reload
Bug 41173: Fix ERM breadcrumb causing page reload
Bug 41173: Fix ERM breadcrumb causing page reload
Bug 41173: Add a Cypress test

Description Pedro Amorim 2025-11-03 16:20:26 UTC

    
Comment 1 Pedro Amorim 2025-11-03 16:21:13 UTC Comment hidden (obsolete)
Comment 2 Pedro Amorim 2025-11-03 16:21:36 UTC Comment hidden (obsolete)
Comment 3 Pedro Amorim 2025-11-07 19:17:48 UTC
Created attachment 189369 [details] [review]
Bug 41173: Fix ERM breadcrumb causing page reload

The main ERM route was missing a 'name' property, causing the
navigation store to treat it as an external path (.pl extension).
This resulted in breadcrumb links using href instead of router-link,
causing unwanted page reloads.

To test:
1. Navigate to ERM module
2. Go to any sub-section (Agreements, Licenses, etc.)
3. Click on 'E-resource management' in the breadcrumb
=> FAIL: Notice the page reloads!
4. Apply the patch
5. Repeat steps 1-3
=> SUCCES: Verify the page doesn't reload and navigation works smoothly
6. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 4 Pedro Amorim 2025-11-07 19:18:57 UTC
Updated Tomas' patch to contain only the change relative to ERM home route (minus the tidy changes, now in a patch in bug 39320).
Comment 5 David Nind 2025-11-08 02:22:57 UTC
I'm assuming for this bug that you need to run a yarn build.

I get this error when I do, and the ERM landing page is blank (normal staff interface header is displayed without any additional ERM module content) - is there anything else you need to do? (The same happens when you just apply bug 
39320.)

yarn build
yarn run v1.22.22
$ yarn css:build && yarn js:build && yarn api:bundle
$ gulp css && gulp css --view opac
[02:09:14] Using gulpfile /kohadevbox/koha/gulpfile.js
[02:09:14] Starting 'css'...
[02:09:14] Finished 'css' after 8.93 ms
[02:09:20] Using gulpfile /kohadevbox/koha/gulpfile.js
[02:09:20] Starting 'css'...
[02:09:20] Finished 'css' after 9.78 ms
$ rspack build --mode development
ERROR in ./koha-tmpl/intranet-tmpl/prog/js/vue/components/ModuleDashboard/ModuleDashboard.vue?vue&type=script&lang=js (../../../../../../../../node_modules/vue-loader/dist/index.js??ruleSet[0]!./koha-tmpl/intranet-tmpl/prog/js/vue/components/ModuleDashboard/ModuleDashboard.vue?vue&type=script&lang=js) 5:0-54
  × Module not found: Can't resolve 'vue-draggable-next' in '/kohadevbox/koha/koha-tmpl/intranet-tmpl/prog/js/vue/components/ModuleDashboard'
   ╭─[5:33]
 3 │ import WidgetPicker from "./WidgetPicker.vue";
 4 │ import { $__ } from "@koha-vue/i18n";
 5 │ import { VueDraggableNext } from "vue-draggable-next";
   ·                                  ────────────────────
 6 │ 
 7 │ export default {
   ╰────


Rspack compiled with 1 error in 1.43 s

Rspack compiled successfully in 1.16 s

Rspack compiled successfully in 707 ms
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Comment 6 Pedro Amorim 2025-11-10 09:19:15 UTC
Sorry David, I think you need to run:
yarn install

After you apply the bug that blocks this one (bug 39320).
Comment 7 Tomás Cohen Arazi (tcohen) 2025-11-10 13:15:20 UTC
(In reply to Pedro Amorim from comment #6)
> Sorry David, I think you need to run:
> yarn install

Just in case, I'd do

 $ ktd --shell
k$ rm -rf node_modules
k$ sudo yarn install --modules-dir /kohadevbox/node_modules
k$ yarn build
Comment 8 David Nind 2025-11-10 19:17:26 UTC
(In reply to Tomás Cohen Arazi (tcohen) from comment #7)
> (In reply to Pedro Amorim from comment #6)
> > Sorry David, I think you need to run:
> > yarn install
> 
> Just in case, I'd do
> 
>  $ ktd --shell
> k$ rm -rf node_modules
> k$ sudo yarn install --modules-dir /kohadevbox/node_modules
> k$ yarn build

Thanks Pedro and Tomás!

That solved the problem.
Comment 9 David Nind 2025-11-10 19:18:27 UTC
Created attachment 189431 [details] [review]
Bug 41173: Fix ERM breadcrumb causing page reload

The main ERM route was missing a 'name' property, causing the
navigation store to treat it as an external path (.pl extension).
This resulted in breadcrumb links using href instead of router-link,
causing unwanted page reloads.

To test:
1. Navigate to ERM module
2. Go to any sub-section (Agreements, Licenses, etc.)
3. Click on 'E-resource management' in the breadcrumb
=> FAIL: Notice the page reloads!
4. Apply the patch
5. Repeat steps 1-3
=> SUCCES: Verify the page doesn't reload and navigation works smoothly
6. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Comment 10 Jonathan Druart 2025-11-13 10:41:29 UTC
Created attachment 189550 [details] [review]
Bug 41173: Add a Cypress test

Patch from commit b591ca4
Comment 11 Jonathan Druart 2025-11-13 10:44:42 UTC
(In reply to Jonathan Druart from comment #10)
> Created attachment 189550 [details] [review] [review]
> Bug 41173: Add a Cypress test
> 
> Patch from commit b591ca4

Matt, can you give me a hand please? I think this test is correct but it's failing using the Cypress UI: clicking on the erm.pl link in the breadcrumb reloads the page(even with the patch applied!)
I think we should use node.redirect if defined, instead of node.path (in store/navigation.js)