From 7b88f0eda48b8a5b880305f5af142df3b2a27295 Mon Sep 17 00:00:00 2001 From: DavertMik Date: Sat, 13 Jun 2026 12:45:09 +0300 Subject: [PATCH] fix: default suite/test meta blocks to compact view when they have fields The compact view started expanded whenever the summary was empty (summaryText.length === 0). Suite blocks typically carry a seeded field with no value yet (e.g. `emoji:`), which produces an empty summary, so they always rendered expanded while test blocks (which have populated fields) collapsed. Base the default on whether the block has any fields at all instead of whether it has a non-empty summary: any block with fields starts compact (suites included), and only a genuinely empty block stays expanded so it's immediately editable. Co-Authored-By: Claude Opus 4.8 --- src/editor/blocks/testMeta.tsx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/editor/blocks/testMeta.tsx b/src/editor/blocks/testMeta.tsx index b4ee6ba..0e50abd 100644 --- a/src/editor/blocks/testMeta.tsx +++ b/src/editor/blocks/testMeta.tsx @@ -196,10 +196,13 @@ export const testMetaBlock = createReactBlockSpec( .filter(({ field }) => field.key.trim().length > 0 && field.value.trim().length > 0) .map(({ field }) => `${field.key}: ${field.value}`) .join(" ยท "); - // Nothing readable to summarise (no fields, or only empty values) -> start - // expanded so the block is immediately editable. `expanded` is UI-only - // state โ€” never serialized. - const [expanded, setExpanded] = useState(() => summaryText.length === 0); + // Default to the compact (collapsed) view whenever the block carries any + // field โ€” this keeps suite blocks compact too, even when their fields have + // no value yet (e.g. a seeded `emoji:` row) and so produce an empty + // summary. Only a genuinely empty block (no fields at all) starts expanded + // so it's immediately editable. `expanded` is UI-only state โ€” never + // serialized. + const [expanded, setExpanded] = useState(() => fields.length === 0); return (