From 2f8ee1998faa676f7df7011d27a81e38f87882e3 Mon Sep 17 00:00:00 2001 From: Sj-Si Date: Fri, 3 May 2024 10:07:17 -0400 Subject: [PATCH] fix scrolling bug caused by invalid filtering and sorting --- javascript/extraNetworksClusterize.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/javascript/extraNetworksClusterize.js b/javascript/extraNetworksClusterize.js index fbb77bce9..07b914b0f 100644 --- a/javascript/extraNetworksClusterize.js +++ b/javascript/extraNetworksClusterize.js @@ -227,7 +227,11 @@ class ExtraNetworksClusterize extends Clusterize { } async sortDataDefaultCallback() { - this.data_obj_keys_sorted = this.sort_fn(this.data_obj); + // we want to apply the sort to the visible items only. + const filtered = Object.fromEntries( + Object.entries(this.data_obj).filter(([k, v]) => v.visible) + ); + this.data_obj_keys_sorted = this.sort_fn(filtered); if (this.sort_reverse) { this.data_obj_keys_sorted = this.data_obj_keys_sorted.reverse(); }