Skip to content

Commit 3afdb88

Browse files
committed
fix #5159 -- support the ipycanvas widget in cocalc-jupyter
- this was a general issue with the correct format of buffers for custom comm messages.
1 parent 50c9329 commit 3afdb88

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/packages/frontend/jupyter/widgets/manager.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,10 @@ VBox([s1, s2])
348348
const { message, buffers } = x;
349349
log("handleMessageChange: ", model_id, message, buffers);
350350
const model = await this.manager.get_model(model_id);
351-
model.trigger("msg:custom", message, buffers);
351+
// Sending DataViews is critical, e.g., it's assumed by ipycanvas
352+
// https://github.com/sagemathinc/cocalc/issues/5159
353+
const views = buffers.map((buffer) => new DataView(buffer));
354+
model.trigger("msg:custom", message, views);
352355
};
353356

354357
// [ ] TODO: maybe have to keep trying for a while until model exists!

0 commit comments

Comments
 (0)