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 following commit updates the tree-widget to fix an issue when trees are manually scrolled and nodes are selected causing a jump (poor user-experience).
The changes include:
- updating the default resize parameter for forceUpdate to false since we only want to clear the entire cache when a resize actually occurs
- updates the onResize to properly resize when performing a forceUpdate

Signed-off-by: Anas Shahid <muhammad.shahid@ericsson.com>
Signed-off-by: vince-fugnitto <vincent.fugnitto@ericsson.com>
  • Loading branch information
Anas Shahid committed Jul 15, 2020
1 parent fd9d8ec commit 12ec6bc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/core/src/browser/tree/tree-widget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ export class TreeWidget extends ReactWidget implements StatefulWidget {
* Force deep resizing and rendering of rows.
* https://github.com/bvaughn/react-virtualized/blob/master/docs/List.md#recomputerowheights-index-number
*/
protected forceUpdate({ resize }: TreeWidget.ForceUpdateOptions = { resize: true }): void {
protected forceUpdate({ resize }: TreeWidget.ForceUpdateOptions = { resize: false }): void {
if (this.view && this.view.list) {
if (resize && this.isVisible) {
this.view.cache.clearAll();
Expand Down Expand Up @@ -389,7 +389,7 @@ export class TreeWidget extends ReactWidget implements StatefulWidget {

protected onResize(msg: Widget.ResizeMessage): void {
super.onResize(msg);
this.forceUpdate();
this.forceUpdate({ resize: true });
}

protected render(): React.ReactNode {
Expand Down

0 comments on commit 12ec6bc

Please sign in to comment.