Skip to content

Commit 8a9d05a

Browse files
committed
Fix issue with instanceof
`image instanceof ImageModel` does not seem to be 100% safe, it works when ipycanvas is installed locally but does not work in the pypi package
1 parent af2ae10 commit 8a9d05a

File tree

2 files changed

+1
-6
lines changed

2 files changed

+1
-6
lines changed

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
},
4545
"dependencies": {
4646
"@jupyter-widgets/base": "^2.0.1",
47-
"@jupyter-widgets/controls": "^1.5.2",
4847
"lodash": ">=4.17.13"
4948
},
5049
"devDependencies": {

src/widget.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ import {
55
DOMWidgetModel, DOMWidgetView, ISerializers, Dict, ViewList, unpack_models
66
} from '@jupyter-widgets/base';
77

8-
import {
9-
ImageModel
10-
} from '@jupyter-widgets/controls';
11-
128
import {
139
MODULE_NAME, MODULE_VERSION
1410
} from './version';
@@ -194,7 +190,7 @@ class CanvasModel extends DOMWidgetModel {
194190
return;
195191
}
196192

197-
if (image instanceof ImageModel) {
193+
if (image.get('_model_name') == 'ImageModel') {
198194
// Create the image manually instead of creating an ImageView
199195
let url: string;
200196
const format = image.get('format');

0 commit comments

Comments
 (0)