JS customize problems

I hid the ‘customize’ button in the workspace using the ‘homepage_hide_button.js’ file below, and it worked. It hides the button after the page loads. However, when returning to the workspace via the application logo or breadcrumbs links in the navbar, the button becomes visible again. This is because clicking on these elements doesn’t trigger a page reload, and the ‘DOMContentLoaded’ event doesn’t occur. As a result, my JavaScript code doesn’t work.

This issue isn’t limited to just the ‘customize’ button for me; some of the customizations I’ve made in the application also don’t work for the same reason.

To be honest, my JavaScript knowledge is weak, and I couldn’t find a solution for this. Is there a solution to this issue?

My hooks file;`

app_include_js = ["/assets/js/erpnext.min.js",

homepage_hide_button.js file;

document.addEventListener("DOMContentLoaded", function() {
    let button= document.querySelector('.btn.btn-secondary.btn-default.btn-sm[data-label="%C3%96zelle%C5%9Ftirme"]')


1 Like

Is there no solution to this issue?