Load the link again when clicking a already selected treeview node, instead of just unselecting it

This fixes the somehow unintuitive behavior described in issue #458
This commit is contained in:
Jan Böhmer 2024-01-27 22:22:07 +01:00
parent 8018e8687b
commit a161e3a520
2 changed files with 5 additions and 4 deletions

View file

@ -132,7 +132,8 @@ export default class extends Controller {
//We only compare the pathname, because the hash and parameters should not matter
if(window.location.pathname !== desired.pathname) {
node.setSelected(false);
//The ignore parameter is important here, otherwise the node will not be unselected
node.setSelected(false, {silent: true, ignorePreventUnselect: true});
//Unregister the watcher
document.removeEventListener('turbo:visit', unselectNode);