Skip to content

Commit

Permalink
[tree] fix scroll behavior when selecting or expanding a node
Browse files Browse the repository at this point in the history
Fixes: #3347
Fixes: #1593

The commit addresses an issue with the update tree-widgets after
performing a manual scroll and selecting a tree node causing a poor user
experience.
The fix modifies the logic of the `forceUpdate` to use `clear` instead
of `clearAll` to clear the cache for only the row that is modified and
not the entire cache.

Signed-off-by: Anas Shahid <muhammad.shahid@ericsson.com>
  • Loading branch information
Anas Shahid committed Jul 9, 2020
1 parent fd9d8ec commit d67005f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/core/src/browser/tree/tree-widget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,12 @@ export class TreeWidget extends ReactWidget implements StatefulWidget {
protected forceUpdate({ resize }: TreeWidget.ForceUpdateOptions = { resize: true }): void {
if (this.view && this.view.list) {
if (resize && this.isVisible) {
this.view.cache.clearAll();
const rowIndex = this.getScrollToRow();
if (rowIndex !== undefined) {
this.view.cache.clear(rowIndex, 0);
} else {
this.view.cache.clearAll();
}
this.view.list.recomputeRowHeights();
} else {
this.view.list.forceUpdateGrid();
Expand Down

0 comments on commit d67005f

Please sign in to comment.