Skip to content

Commit

Permalink
Backport PR jupyterlab#14865: In defer mode render enough cells to fi…
Browse files Browse the repository at this point in the history
…ll the viewport
  • Loading branch information
fcollonval authored and meeseeksmachine committed Aug 2, 2023
1 parent 4461759 commit eda8b6c
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion packages/notebook/src/widget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -887,8 +887,19 @@ export class StaticNotebook extends WindowedList {
cellIdx++;
}

// If the notebook is not fully rendered
if (cellIdx < this.cellsArray.length) {
this._scheduleCellRenderOnIdle();
// If we are defering the cell rendering and the rendered cells do
// not fill the viewport yet
if (
this.notebookConfig.windowingMode === 'defer' &&
this.viewportNode.clientHeight < this.node.clientHeight
) {
// Spend more time rendering cells to fill the viewport
await this._runOnIdleTime();
} else {
this._scheduleCellRenderOnIdle();
}
} else {
if (this._idleCallBack) {
window.cancelIdleCallback(this._idleCallBack);
Expand Down

0 comments on commit eda8b6c

Please sign in to comment.