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: use nested op from data (#6381)
Myles Scolnick3e6c5fdc3d09
diff --git a/frontend/src/core/islands/main.ts b/frontend/src/core/islands/main.tsindex 1693295583..6eee13aa0b 100644--- a/frontend/src/core/islands/main.ts+++ b/frontend/src/core/islands/main.ts@@ -103,7 +103,7 @@ export async function initialize() {// Consume messages from the kernelIslandsPyodideBridge.INSTANCE.consumeMessages((message) => {const msg = jsonParseWithSpecialChar(message);- switch (msg.op) {+ switch (msg.data.op) {case "banner":case "missing-package-alert":case "installing-package-alert":@@ -185,7 +185,7 @@ export async function initialize() {case "reconnected":return;default:- logNever(msg);+ logNever(msg.data);}});diff --git a/frontend/src/core/kernel/messages.ts b/frontend/src/core/kernel/messages.tsindex 0b6d1182f6..db37864e11 100644--- a/frontend/src/core/kernel/messages.ts+++ b/frontend/src/core/kernel/messages.ts@@ -40,21 +40,17 @@ export type SQLTableListPreview =OperationMessageData<"sql-table-list-preview">;export type SecretKeysResult = OperationMessageData<"secret-keys-result">;export type StartupLogs = OperationMessageData<"startup-logs">;-export type MessageOperation = schemas["KnownUnions"]["operation"];+export type CellMessage = OperationMessageData<"cell-op">;+export type Capabilities = OperationMessageData<"kernel-ready">["capabilities"];-export type OperationMessageType = MessageOperation["op"];-export type OperationMessage = {- [Type in OperationMessageType]: {- op: Type;- data: Omit<Extract<MessageOperation, { op: Type }>, "op">;- };-}[OperationMessageType];+export type MessageOperationUnion = schemas["KnownUnions"]["operation"];-export type CellMessage = OperationMessageData<"cell-op">;+export type OperationMessageType = MessageOperationUnion["op"];+export type OperationMessage = {+ data: MessageOperationUnion;+};export type OperationMessageData<T extends OperationMessageType> = Omit<- Extract<MessageOperation, { op: T }>,+ Extract<MessageOperationUnion, { op: T }>,"op">;--export type Capabilities = OperationMessageData<"kernel-ready">["capabilities"];diff --git a/frontend/src/core/websocket/useMarimoWebSocket.tsx b/frontend/src/core/websocket/useMarimoWebSocket.tsxindex 201ce08b6e..dacb0a3ce0 100644--- a/frontend/src/core/websocket/useMarimoWebSocket.tsx+++ b/frontend/src/core/websocket/useMarimoWebSocket.tsx@@ -86,7 +86,7 @@ export function useMarimoWebSocket(opts: {const handleMessage = (e: MessageEvent<JsonString<OperationMessage>>) => {const msg = jsonParseWithSpecialChar(e.data);- switch (msg.op) {+ switch (msg.data.op) {case "reload":reloadSafe();return;@@ -267,7 +267,7 @@ export function useMarimoWebSocket(opts: {setCellIds({ cellIds: msg.data.cell_ids as CellId[] });return;default:- logNever(msg);+ logNever(msg.data);}};