From 59cad833e21b046ad1fe88550baf0615dec79655 Mon Sep 17 00:00:00 2001 From: Tomas Kislan Date: Tue, 4 Nov 2025 18:11:50 +0000 Subject: [PATCH 1/2] fix: Fix input-slider value parsing from metadata Signed-off-by: Tomas Kislan --- src/notebooks/deepnote/inputBlockContentFormatter.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/notebooks/deepnote/inputBlockContentFormatter.ts b/src/notebooks/deepnote/inputBlockContentFormatter.ts index 8568866b5..28e8acd9c 100644 --- a/src/notebooks/deepnote/inputBlockContentFormatter.ts +++ b/src/notebooks/deepnote/inputBlockContentFormatter.ts @@ -3,6 +3,8 @@ * This is the single source of truth for how input block values are displayed in cells. */ +import z from 'zod'; + /** * Gets the expected language ID for an input block type. * This is the single source of truth for input block language modes. @@ -29,6 +31,7 @@ export function getInputBlockLanguage(blockType: string): string | undefined { * @returns The formatted cell content string */ export function formatInputBlockCellContent(blockType: string, metadata: Record): string { + console.log('formatInputBlockCellContent', blockType, metadata); switch (blockType) { case 'input-text': case 'input-textarea': { @@ -57,7 +60,8 @@ export function formatInputBlockCellContent(blockType: string, metadata: Record< case 'input-slider': { const value = metadata.deepnote_variable_value; - return typeof value === 'number' ? String(value) : ''; + const parsedValueResult = z.coerce.number().safeParse(value); + return parsedValueResult.success ? String(parsedValueResult.data) : ''; } case 'input-checkbox': { From 8c9e2a6e1230f43675359f76f0a925f069e7fdf3 Mon Sep 17 00:00:00 2001 From: Tomas Kislan Date: Tue, 4 Nov 2025 18:39:02 +0000 Subject: [PATCH 2/2] fix: Remove forgotten debug console.log Signed-off-by: Tomas Kislan --- src/notebooks/deepnote/inputBlockContentFormatter.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/notebooks/deepnote/inputBlockContentFormatter.ts b/src/notebooks/deepnote/inputBlockContentFormatter.ts index 28e8acd9c..0d5d740de 100644 --- a/src/notebooks/deepnote/inputBlockContentFormatter.ts +++ b/src/notebooks/deepnote/inputBlockContentFormatter.ts @@ -31,7 +31,6 @@ export function getInputBlockLanguage(blockType: string): string | undefined { * @returns The formatted cell content string */ export function formatInputBlockCellContent(blockType: string, metadata: Record): string { - console.log('formatInputBlockCellContent', blockType, metadata); switch (blockType) { case 'input-text': case 'input-textarea': {