Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resizing the running sidebar needlessly re-renders the open tabs section #16184

Open
krassowski opened this issue Apr 18, 2024 · 0 comments
Open

Comments

@krassowski
Copy link
Member

Description

Resizing the running sidebar needlessly re-renders the open tabs section. This is because the OpenTabsSignaler is connected to layoutModified signal indiscriminately, and reiszing is in fact a layout modification.

class OpenTabsSignaler {
constructor(labShell: ILabShell) {
this._labShell = labShell;
this._labShell.layoutModified.connect(this._emitTabsChanged, this);

However, the listener does not filter out the modifications which do not change the open tabs:

private _emitTabsChanged(): void {
this._widgets.forEach(widget => {
widget.title.changed.disconnect(this._emitTabsChanged, this);
});
this._widgets = [];
this._tabsChanged.emit(void 0);
}

This is problematic when many tabs are open as it slows down responsiveness of the interface making the resize operation slower. However, since the list is rendered with virtual DOM using React, the performance impact is limited to spurious rerendering rather than to DOM updates.

Reproduce

  1. Open the running sidebar
  2. Add a breakpoint on:
  3. Resize the sidebar
  4. See the react does an unnecessary rerender

Expected behavior

The listener of layoutModified signal (_emitTabsChanged) should filter out resize operations, or we should use a more granular signal rather than the generic layoutModified

Context

  • JupyterLab version: 4.1.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants