From 0bed497d0c7b40377967b6554ea6666624800061 Mon Sep 17 00:00:00 2001 From: Philipp Rudiger Date: Thu, 4 Apr 2024 13:02:37 +0200 Subject: [PATCH] Avoid unncessary rescroll on Column --- panel/models/column.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/panel/models/column.ts b/panel/models/column.ts index d64496952e..5dbca25a72 100644 --- a/panel/models/column.ts +++ b/panel/models/column.ts @@ -36,8 +36,11 @@ export class ColumnView extends BkColumnView { trigger_auto_scroll(): void { const limit = this.model.auto_scroll_limit + if (limit == 0) { + return + } const within_limit = this.distance_from_latest <= limit - if (limit == 0 || !within_limit) { + if (!within_limit) { return } @@ -50,12 +53,11 @@ export class ColumnView extends BkColumnView { toggle_scroll_button(): void { const threshold = this.model.scroll_button_threshold - const exceeds_threshold = this.distance_from_latest >= threshold - if (this.scroll_down_button_el) { - this.scroll_down_button_el.classList.toggle( - "visible", threshold !== 0 && exceeds_threshold, - ) + if (!this.scroll_down_button_el || threshold === 0) { + return } + const exceeds_threshold = this.distance_from_latest >= threshold + this.scroll_down_button_el.classList.toggle("visible", exceeds_threshold) } override render(): void {