ColorlibHQ / AdminLTE

AdminLTE - Free admin dashboard template based on Bootstrap 5
https://adminlte.io
MIT License
43.74k stars 18.17k forks source link

[BUG] Sidebar not working correctly with React.js on Vite #5597

Open MikhaelMounay opened 1 month ago

MikhaelMounay commented 1 month ago

This is a very similar bug discussed in this issue. https://github.com/ColorlibHQ/AdminLTE/issues/1570

I working on a web application with AdminLTE 3 and React.js 18 on Vite 5. The sidebar works fine without adding any code on Google Chrome and Brave. However, this error persists on Microsoft Edge (Chromium based) where the buttons of the tree view are not working.

If I use this snippet,

export function loadTreeview() {
    $('[data-widget="treeview"]').each(function () {
        if ($(this).data('treeview-init') === undefined) {
            $(this).Treeview('init');
            $(this).data('treeview-init', true);
        }
    });
}

MS Edge works fine, but Google Chrome & Brave don't work as expected where the menus expand only but don't collapse.

Anyone has an idea ?! Thank you in advance!