Skip to content

Commit a4a91d6

Browse files
author
Akos Kitta
committed
Reset scrollbar on update.
Signed-off-by: Akos Kitta <[email protected]>
1 parent ca3b754 commit a4a91d6

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

arduino-ide-extension/src/browser/widgets/component-list/component-list.tsx

+5-2
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export class ComponentList<T extends ArduinoComponent> extends React.Component<
6363
prevState: ComponentList.State
6464
): void {
6565
if (this.resizeAllFlag || this.props.items !== prevProps.items) {
66-
this.clearAll();
66+
this.clearAll(true);
6767
} else if (this.state.focusIndex !== prevState.focusIndex) {
6868
if (typeof this.state.focusIndex === 'number') {
6969
this.clear(this.state.focusIndex);
@@ -78,11 +78,14 @@ export class ComponentList<T extends ArduinoComponent> extends React.Component<
7878
this.list = ref || undefined;
7979
};
8080

81-
private clearAll(): void {
81+
private clearAll(scrollToTop = false): void {
8282
this.resizeAllFlag = false;
8383
this.cache.clearAll();
8484
if (this.list) {
8585
this.list.recomputeRowHeights();
86+
if (scrollToTop) {
87+
this.list.scrollToPosition(0);
88+
}
8689
}
8790
}
8891

0 commit comments

Comments
 (0)