A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
chore/fix: parse correct message for anywidget (#5741)
Shahmir Varqha7b76d176b89e
diff --git a/frontend/src/plugins/impl/anywidget/__tests__/model.test.ts b/frontend/src/plugins/impl/anywidget/__tests__/model.test.tsindex 90ff068a3c..4339f87e7a 100644--- a/frontend/src/plugins/impl/anywidget/__tests__/model.test.ts+++ b/frontend/src/plugins/impl/anywidget/__tests__/model.test.ts@@ -337,6 +337,20 @@ describe("ModelManager", () => {expect(model.get("count")).toBe(1);});+ it("should handle custom messages", async () => {+ const model = new Model({ count: 0 }, vi.fn(), vi.fn(), new Set());+ const callback = vi.fn();+ model.on("msg:custom", callback);+ modelManager.set("test-id", model);++ await handle({+ modelId: "test-id",+ message: { method: "custom", content: { count: 1 } },+ buffers: [],+ });+ expect(callback).toHaveBeenCalledWith({ count: 1 }, undefined);+ });+it("should handle close messages", async () => {const model = new Model({ count: 0 }, vi.fn(), vi.fn(), new Set());modelManager.set("test-id", model);diff --git a/frontend/src/plugins/impl/anywidget/model.ts b/frontend/src/plugins/impl/anywidget/model.tsindex e3b8ae5b21..b86ffa10a1 100644--- a/frontend/src/plugins/impl/anywidget/model.ts+++ b/frontend/src/plugins/impl/anywidget/model.ts@@ -254,7 +254,7 @@ export async function handleWidgetMessage(if (msg.method === "custom") {const model = await modelManager.get(modelId);- model.receiveCustomMessage(msg.content);+ model.receiveCustomMessage(msg);return;}