From 9c764268dcb0ba940f38587e2527da9cc164917d Mon Sep 17 00:00:00 2001 From: Bilel KIHAL Date: Fri, 25 Oct 2024 13:59:24 +0200 Subject: [PATCH] revert adding useVisibility, and extract tree_view_pages to a constant --- app/javascript/controllers/simple_tree_controller.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/javascript/controllers/simple_tree_controller.js b/app/javascript/controllers/simple_tree_controller.js index 86e8bb61d..4cece829a 100644 --- a/app/javascript/controllers/simple_tree_controller.js +++ b/app/javascript/controllers/simple_tree_controller.js @@ -1,4 +1,7 @@ import { Controller } from '@hotwired/stimulus' + +const TREE_VIEW_PAGES = ['classes', 'properties', 'schemes', 'collections', 'instances'] + // Connects to data-controller="simple-tree" export default class extends Controller { @@ -26,8 +29,8 @@ export default class extends Controller { #centerTreeView() { setTimeout(() => { const location = window.location.href; - const isTreeViewPage = ['classes', 'properties', 'schemes', 'collections', 'instances'] - .some(param => location.includes(`p=${param}`)); + + const isTreeViewPage = TREE_VIEW_PAGES.some(param => location.includes(`p=${param}`)); if (isTreeViewPage) { const activeElem = this.element.querySelector('.tree-link.active');