Skip to content
This repository was archived by the owner on Sep 1, 2022. It is now read-only.

Protect against a potential timing error in the model creation logic #322

Merged
merged 1 commit into from
Apr 25, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions elements/urth-core-behaviors/jupyter-widget-behavior.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@
widget_class: this.kernelClass
}
).then(function(model) {
//This check is to protect against a timing in ipywidgets where the comm can be close
//by the time it gets to resolve this promise
if(!model.comm.kernel.comm_manager.comms[model.comm.comm_id]){
this._handleCommDisconnect();
return;
}

console.log('Model creation successful!', model);
this.__modelChangeCallback = this._onModelChange.bind(this);
this.__commCloseCallback = this._handleCommDisconnect.bind(this);
Expand Down