Any new page that I add outside of the ones that the template already has, throws me that error, do I have to modify a specific file? this error happens in MasterInit.razor
Stack
Microsoft.JSInterop.JSException: 'Cannot read properties of undefined (reading 'closest')
TypeError: Cannot read properties of undefined (reading 'closest')
at _getItemParentElement (http://localhost:5170/assets/js/scripts.bundle.js:1938:24)
at _getItemParentElements (http://localhost:5170/assets/js/scripts.bundle.js:1959:22)
at _setActiveLink (http://localhost:5170/assets/js/scripts.bundle.js:2251:27)
at KTMenu.the.setActiveLink (http://localhost:5170/assets/js/scripts.bundle.js:2406:16)
at KTMenu.updateByLinkAttribute (http://localhost:5170/assets/js/scripts.bundle.js:2657:26)
at http://localhost:5170/_framework/blazor.server.js:1:3501
at new Promise (
at kt.beginInvokeJSFromDotNet (http://localhost:5170/_framework/blazor.server.js:1:3475)
at http://localhost:5170/_framework/blazor.server.js:1:72054
at Array.forEach (
Regards
Hi,
Unfortunately, we are not able to reproduce this error. If there are any steps on how to reproduce it please describe them.
To add a new page you can do the steps below:
@page "/your-page-route"
<h1>You page content</h1>
I think the problem is not in the new page, but in the SideBarMenu.
In the blazor template, in MasterInit, KTMenu.updateByLinkAttribute is invoked in order to highlight the menu link corresponding to the page you have created.
The inside code assumes the link is inside an accordion, I guess, and tries to expand it.
If that menu is not inside an accordion, in the same way the sample renders it, you have an exception.
Digging a little deeper I think this could depend on menu.setActiveLink(link);
I'm not able to debug it,