Skip to content

Commit

Permalink
perf: remove focus tracking in notebook panel causing extra re-render (
Browse files Browse the repository at this point in the history
…#1983)

Removed orphaned code that used to do things, but now doesn't do
anything but update an unused isFocused state variable. This was causing
an additional re-render on focus when state was then updated.
  • Loading branch information
dsmmcken authored May 3, 2024
1 parent c3ea867 commit a283e13
Showing 1 changed file with 0 additions and 16 deletions.
16 changes: 0 additions & 16 deletions packages/dashboard-core-plugins/src/panels/NotebookPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ interface NotebookPanelState {
message?: string | undefined;
};
isDashboardActive: boolean;
isFocused: boolean;
isLoading: boolean;
isLoaded: boolean;
isPreview: boolean;
Expand Down Expand Up @@ -181,7 +180,6 @@ class NotebookPanel extends Component<NotebookPanelProps, NotebookPanelState> {
constructor(props: NotebookPanelProps) {
super(props);

this.handleBlur = this.handleBlur.bind(this);
this.handleCloseCancel = this.handleCloseCancel.bind(this);
this.handleCloseDiscard = this.handleCloseDiscard.bind(this);
this.handleCloseSave = this.handleCloseSave.bind(this);
Expand All @@ -195,7 +193,6 @@ class NotebookPanel extends Component<NotebookPanelProps, NotebookPanelState> {
this.handleFind = this.handleFind.bind(this);
this.handleMinimapChange = this.handleMinimapChange.bind(this);
this.handleWordWrapChange = this.handleWordWrapChange.bind(this);
this.handleFocus = this.handleFocus.bind(this);
this.handleLinkClick = this.handleLinkClick.bind(this);
this.handleLoadSuccess = this.handleLoadSuccess.bind(this);
this.handleLoadError = this.handleLoadError.bind(this);
Expand Down Expand Up @@ -273,7 +270,6 @@ class NotebookPanel extends Component<NotebookPanelProps, NotebookPanelState> {
this.state = {
error: undefined,
isDashboardActive,
isFocused: false,
isLoading: true,
isLoaded: false,
isPreview,
Expand Down Expand Up @@ -828,16 +824,6 @@ class NotebookPanel extends Component<NotebookPanelProps, NotebookPanelState> {
}
}

handleBlur(): void {
log.debug('handleBlur');
this.setState({ isFocused: false });
}

handleFocus(): void {
log.debug('handleFocus');
this.setState({ isFocused: true });
}

/**
* @param event The click event from clicking on the link
*/
Expand Down Expand Up @@ -1304,8 +1290,6 @@ class NotebookPanel extends Component<NotebookPanelProps, NotebookPanelState> {
onTabBlur={this.handleTabBlur}
onSessionOpen={this.handleSessionOpened}
onSessionClose={this.handleSessionClosed}
onFocus={this.handleFocus}
onBlur={this.handleBlur}
additionalActions={additionalActions}
renderTabTooltip={() => itemName}
>
Expand Down

0 comments on commit a283e13

Please sign in to comment.