Skip to content

Commit

Permalink
Avoid unncessary rescroll on Column
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Apr 4, 2024
1 parent ba01468 commit 0bed497
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions panel/models/column.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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 {
Expand Down

0 comments on commit 0bed497

Please sign in to comment.