Skip to content

Commit f8ebd42

Browse files
committed
refactor: remove setTimeout deferrals from RowNavigation scroll flow
The two setTimeout wrappers in goToRow and _scrollToRow were deferring execution unnecessarily — goToRow now calls _scrollToRow directly, and _scrollToRow resolves synchronously after scrollIntoView rather than deferring to the next tick.
1 parent 18e53be commit f8ebd42

1 file changed

Lines changed: 9 additions & 15 deletions

File tree

log-viewer/src/tabulator/module/RowNavigation.ts

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,7 @@ export class RowNavigation extends Module {
5858
this.tableHolder.focus();
5959
}
6060

61-
return new Promise<void>((resolve) => {
62-
setTimeout(() => {
63-
this._scrollToRow(row, opts).then(resolve);
64-
});
65-
});
61+
return this._scrollToRow(row, opts);
6662
}
6763

6864
_scrollToRow(row: RowComponent, opts: GoToRowOptions): Promise<void> {
@@ -73,19 +69,17 @@ export class RowNavigation extends Module {
7369
.catch(() => {})
7470
.then(() => {
7571
return new Promise<void>((resolve) => {
76-
setTimeout(() => {
77-
const elem = row.getElement();
72+
const elem = row.getElement();
7873

79-
if (scrollIfVisible || !this._isVisible(elem)) {
80-
elem.scrollIntoView({ behavior: 'auto', block: 'center', inline: 'start' });
81-
}
74+
if (scrollIfVisible || !this._isVisible(elem)) {
75+
elem.scrollIntoView({ behavior: 'auto', block: 'center', inline: 'start' });
76+
}
8277

83-
if (focusRow) {
84-
elem.focus();
85-
}
78+
if (focusRow) {
79+
elem.focus();
80+
}
8681

87-
resolve();
88-
});
82+
resolve();
8983
});
9084
});
9185
}

0 commit comments

Comments
 (0)