Skip to content

Commit d583453

Browse files
committed
Try dispatching a resize message manually
1 parent f6b65e3 commit d583453

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

packages/application-extension/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
"@jupyterlab/translation": "^4.0.0-alpha.14",
5656
"@lumino/coreutils": "^2.0.0-alpha.6",
5757
"@lumino/disposable": "^2.0.0-alpha.6",
58+
"@lumino/messaging": "^2.0.0-alpha.6",
5859
"@lumino/widgets": "^2.0.0-alpha.6"
5960
},
6061
"devDependencies": {

packages/application-extension/src/index.ts

+14-1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ import {
5050
IDisposable
5151
} from '@lumino/disposable';
5252

53+
import { MessageLoop } from '@lumino/messaging';
54+
5355
import { Menu, Widget } from '@lumino/widgets';
5456

5557
import { SideBarPalette } from './sidebarpalette';
@@ -201,7 +203,7 @@ const opener: JupyterFrontEndPlugin<void> = {
201203
// TODO: fix upstream?
202204
await settingRegistry?.load('@jupyterlab/notebook-extension:panel');
203205

204-
await new Promise(async () => {
206+
await new Promise(async (resolve, reject) => {
205207
// TODO: get factory from file type instead?
206208
if (ext === '.ipynb') {
207209
docManager.open(file, NOTEBOOK_FACTORY, undefined, {
@@ -212,7 +214,18 @@ const opener: JupyterFrontEndPlugin<void> = {
212214
ref: '_noref'
213215
});
214216
}
217+
resolve(void 0);
215218
});
219+
220+
// force triggering a resize event to try fixing toolbar rendering issues:
221+
// https://github.com/jupyter/notebook/issues/6553
222+
const currentWidget = app.shell.currentWidget;
223+
if (currentWidget) {
224+
MessageLoop.sendMessage(
225+
currentWidget,
226+
Widget.ResizeMessage.UnknownSize
227+
);
228+
}
216229
}
217230
});
218231

0 commit comments

Comments
 (0)