Skip to content

Commit

Permalink
Delay a mimedocument from being ready until the context is ready.
Browse files Browse the repository at this point in the history
  • Loading branch information
jasongrout committed May 12, 2018
1 parent 1107f69 commit 60ce4d7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/docregistry/src/default.ts
Expand Up @@ -417,15 +417,17 @@ abstract class ABCWidgetFactory<T extends IDocumentWidget, U extends DocumentReg
export
class DocumentWidget<T extends Widget = Widget, U extends DocumentRegistry.IModel = DocumentRegistry.IModel> extends MainAreaWidget<T> implements IDocumentWidget<T, U> {
constructor(options: DocumentWidget.IOptions<T, U>) {

// Include the context ready promise in the widget ready promise
options.ready = Promise.all([options.ready, options.context.ready]).then( () => { return; });
super(options);

this.context = options.context;

this.context.pathChanged.connect(this._onPathChanged, this);
this._onPathChanged();
}

// TODO: redefine the populated/isPopulated to *also* wait for the context load/rendering

/**
* Handle a path change.
*/
Expand Down

0 comments on commit 60ce4d7

Please sign in to comment.